Qt World Summit: Submit your Presentation

[Solved]how to remove the default button box bar in QDialog

  • everybody,

    I am with a small problem, I cant remove the default buttonbox in a Qdialog. I have not assigned any function to the default buttons. I removed the buttons but there is still the blank button bar
    What do i do?


  • A standard QDialog has no buttons unless you assign some. Are you perhaps using a derived class?

    Perhaps we could help if you provided some code :)

  • You have to remove the QDialogButtonBox. Not just the buttons from it.

    By the way,like goblincoding said, you wont have it by default. Plus if you are using QtCreator, there are Dialog with / with out buttons options in New -> File or Project -> Qt -> DesignerForm class -> .... :)

  • goblincoding,

    Even i thought the same tht the default QDialog has no buttons by default. Derived class meaning?
    I tried creating a new QDialog as Rahul suggested but it shows default button box bar, with out the buttons. It shows it while running on C7 but not on the form
    AddNewHistoryForm::AddNewHistoryForm(QWidget *parent) :QDialog(parent),ui(new Ui::AddNewHistoryForm)



    :( :(


  • I have solved the problem but im not clear of what exactly i have done, so if some one could explain wat ive done :)

    i used to call this AddNewHistoryForm from a class named HistoryForm like this.

    AddNewHistoryForm paddnewhistfrm(this);

    I changed that to this
    AddNewHistoryForm *pAddNewHistFrm = new AddNewHistoryForm();

    And voila the blank buttonbox disappeared. .

  • Good to know its solved alfah!

    I am just guessing it here, that when you show a dialog on symbian, symbian framework overrule the appearance. I mean those two buttons, which are assigned/aligned for left and right softkeys. When you show it full screen, nothing override the appearance, its just your app window that rules the whole screen. Well, thats my guess :) :)

  • yeaa may be. .

    anyway thanx for the help :)

  • Glad you solved it :)

    Just wish to answer your final question:

    [quote author="alfah" date="1315458144"]Derived class meaning?[/quote]

    [quote author=Wikipedia]A superclass, base class, or parent class is a class from which other classes are derived. The classes that are derived from a superclass are known as child classes, derived classes, or subclasses.[/quote]

    I thought you'd perhaps used one of the convenience classes like QFileDialog/QMessageBox or had inherited from QDialog yourself :)

Log in to reply