Windowflags for QInputDialog



  • Hi
    I want to remove the Contexthelp button in the toolbar. I have tried with the following code but it doesnt do anything.

    Qt::WindowFlags flags;
    flags = flags & ~Qt::WindowContextHelpButtonHint;
    QString text = QInputDialog::getText(this, tr("Rename page"),tr("Page Name:"), QLineEdit::Normal, tab->tabText(i),&ok,flags);
    

    Are there another way to remove the contexthelp button?



  • @chaf1984
    you may try this

        QString text = QInputDialog::getText(this, tr("Rename page"),tr("Page Name:"), QLineEdit::Normal, tab->tabText(i),&ok,(this->windowFlags() & ~Qt::WindowContextHelpButtonHint));
    

    or

        Qt::WindowFlags flags = windowFlags();
    flags = flags & ~Qt::WindowContextHelpButtonHint;
    QString text = QInputDialog::getText(this, tr("Rename page"),tr("Page Name:"), QLineEdit::Normal, tab->tabText(i),&ok,flags);


  • @Ratzz said:

    (this->windowFlags() & ~Qt::WindowContextHelpButtonHint)

    The problem is when I use (this->windowFlags() & ~Qt::WindowContextHelpButtonHint) it gets the windowsflags from the mainwindow with mini and max buttons.
    But got what I wanted with this code

    (this->windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::WindowMinMaxButtonsHint)
    

    Are there a better way to do this?



  • @chaf1984 said:
    May be from your code.

        Qt::WindowFlags flags = windowFlags();
        Qt::WindowFlags helpFlag =   Qt::WindowContextHelpButtonHint| Qt::WindowMinMaxButtonsHint;
        flags = flags & (~helpFlag);
    
      QString text = QInputDialog::getText(this, tr("Rename page"),tr("Page Name:"), QLineEdit::Normal, tab->tabText(i),&ok,flags);


  • Thanks for the help, got it working. The solution works and I can get going with the other stuff :)



  • @chaf1984
    Glad it helped.
    Once your problem is solved use the Topic Tools button to mark as Solved.
    Thank you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.