Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [RESOLVED] Qt modeless dialog problem
QtWS25 Last Chance

[RESOLVED] Qt modeless dialog problem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrcgnerd
    wrote on last edited by
    #1

    Hello I have a problem:

    I want ot ad costume window flags to dialog, so I use this code:

    @ ui->setupUi(this);
    Qt::WindowFlags flags = 0;
    flags |= Qt::WindowMaximizeButtonHint;
    flags |= Qt::WindowCloseButtonHint;
    setWindowFlags( flags );@

    Proble is that I can open dialog just using it as model, if I open dialog as modeless, dialog opens but it shows up inside Mainwindow, I mean Dialog components are displayed on top of main window components ant acts like oen window. It's realy strange.
    If I use it like model everything works ok Dialog opens and flags are being displayed.
    But I need it to be modeless.

    @
    

    // Modeless not working properly:
    Dialog *Dia;
    Dia = new PirkejoLangas(this);
    Dia->setWindowFlags(Qt::WindowMaximizeButtonHint);
    Dia->show();

    // Model working ok:
    Dialog Dia;
    Dia.setModal(true);
    Dia.exec();
    @

    Why it is happening ?

    Sory for my english.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrcgnerd
      wrote on last edited by
      #2

      All I want to do is to add Maximise Window button in modeless dialog.
      With model dialog my code works, but with modeless don't

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mrcgnerd
        wrote on last edited by
        #3

        Ok I got it !

        If enyone have the same problem, all you have to do is to add Qt::Dialog in your code:

        @Qt::WindowFlags flags = 0;
        flags |= Qt::Dialog;
        flags |= Qt::WindowMaximizeButtonHint;
        flags |= Qt::WindowCloseButtonHint;
        setWindowFlags( flags );@

        Or just:

        @setWindowFlags( Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);@

        Now the dialog opens separately from Main window.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved