kadreg |
Bonjour, avec QT sous linux, je cherche à créer une boite de dialogue dont on ne puisse pas changer la taille, mais dont on ai quand même une barre de titre (sans la barre, j'y arrive). A priori, le setSizePolicy est fait pour ça, mais ça marche pas :
Voici les sources maclasse.h :
Code :
- class AboutBox : public QDialog {
- Q_OBJECT
- public:
- AboutBox (QWidget *parent=0, const char *name=0);
- private:
- QSizePolicy sizePolicy() const;
- };
|
Et le cpp associé :
Code :
- AboutBox::AboutBox( QWidget *parent=0, const char *name=0 )
- : QDialog( parent, name, true,
- WStyle_Customize | WStyle_Title | WStyle_SysMenu){
- this->setCaption ("About... " );
- QPushButton *okButton = new QPushButton (this, "OKButton" );
- okButton->setText ("OK" );
- okButton->setGeometry (100, 80, 120, 30);
- QLabel *label = new QLabel (this, "aboutBoxLabel" );
- label->setText ("this is the content of the <br> about box" );
- label->setGeometry (5, 5, 220, 70);
- connect (okButton, SIGNAL (clicked ()), this, SLOT (close ()));
- adjustSize ();
- }
- QSizePolicy AboutBox::sizePolicy() const {
- return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
- }
|
Qu'es-ce que j'ai encore raté ? |