Windows Mobile close close button (designed using Qt)

Whenever I install the maximum Windows Mobile applications using the code I developed using Qt, their title disappears and only the default title bar for Windows Mobile remains. However, whenever I click on this X button, the application does not close; instead, he continues to lag.

alt text http://img27.imageshack.us/img27/2296/winmobileexit.jpg

After several Google searches, I realized that this is the default behavior for the X button on Windows Mobile , which is also the cause of my problem; when I want to show a minimized / hidden program by clicking "Activate" from "Settings-> System-> Memory-> Launch Programs",

alt text http://img17.imageshack.us/img17/7387/winmobileexit2.jpg

The application does not repaint and remains invisible, and child widgets respond to the corresponding events:

alt text http://img505.imageshack.us/img505/5276/winmobileexit3.jpg

I don’t think this behavior has anything to do with my code, since this problem even occurs with the following simple code: (I would appreciate it if you could check it on your device)

#include <QApplication>
#include <QtGui>


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QLabel w("aduket");
    w.setWindowState(w.windowState()|Qt::WindowMaximized);
    w.show();
    return a.exec();
}

Although, I tried to get the closed event of this button, I could not. But then again, the only solution that came to me was to delete this X button and add the "Exit" element to the lower right menu. It is reasonable? What could be causing this behavior? Do you have any idea how to resolve this behavior?

Thanks in advance.

+3
4

"Smart Minimize" , Windows, WS_NONAVDONEBUTTON. CF MinimizeButton false. C/++ CreateWindow ( , , SHDoneButton).

Qt, , , . Qt, , , .

+4

.NET/CF MinimizeBox, false, [Ok], . , Qt .

+1

, SHDoneButton.

:

  • SHDB_HIDE - WM "X" , . , "X" WM_QUIT .

  • SHDB_SHOW - "ok" IDOK WM_COMMAND .

  • SHDB_SHOWCANCEL - "x" IDCANCEL WM_COMMAND .

+1

Thank you for your irreplaceable answers. All of them contributed to my decision. When I tried to change the X button to the OK button, I found that there is a Windows CE flag to make the OK button visible .

 #ifdef Q_OS_WINCE
       setWindowFlags(windowFlags()|Qt::WindowOkButtonHint);
 #endif

after setting this button, I redefined the event function (QEvent *) to catch the event fired from OK to close the application.

bool MainWindow::event(QEvent *mEvent)
{   

    if (mEvent->type()==QEvent::OkRequest)
    {
         qApp->closeAllWindows();
         return true; 
    }

    return QMainWindow::event(mEvent);

}

and now it works like a charm =)

+1
source

Source: https://habr.com/ru/post/1711822/


All Articles