PDA

View Full Version : Having an issue with Qt Window Flags



tescrin
20th June 2012, 17:18
Basically in my custom class (derived from QDialog) when I set any window flags (that I've tried) I can't get see the window. I've used redundant calls to "show()" as this (http://qt-project.org/doc/qt-5.0/qwidget.html#windowFlags-prop) seems to imply, but I still can't see the window. Here is the relevant code:

//synthkeypad.cpp
SynthKeypad::SynthKeypad(QWidget *parent) :
QDialog(parent),
ui(new Ui::SynthKeypad)
{
//initialize ui file
ui->setupUi(this);

//set the window to modify size
layout()->setSizeConstraint(QLayout::SetFixedSize);

//initialize connections
setupConnections();

this->setStyleSheet("QDialog {background-color: rgb(151,111,94);}");

//***If this line is commented out, the window works as desired, EXCEPT it has help and close buttons, a title bar, etc..***
this->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
}



void GenrepFE::setupPPMKeypad(SynthKeypad *inpad)
{
//Just putting this all here so you don't assume this function is screwing things up
//these are just wrapper functions to initialize parameters of the dialog
inpad->setSpinBoxRange(-500,500);
inpad->addType(QString("ppm"));
inpad->enableNegative();
inpad->setTextBlob("blah");
}

void GenrepFE::openPPMKeypad()
{
ui->synthButton->releaseMouse(); //don't worry about this ;)

SynthKeypad *ppmKeypad = new SynthKeypad(this);
setupPPMKeypad(ppmKeypad);
connect(ppmKeypad,SIGNAL(accepting(double)),this,S LOT(ppmAccepted(double)));
ppmKeypad->exec();
ppmKeypad->show(); //this is the "redundant" call I added, even though exec should be showing the window like normal.

delete ppmKeypad;
}

If someone could point out why the window flags are leaving the window hidden (or maybe I've used a bad combination?) despite
being show()n, that'd be very helpful. Also, if you can provide an explanation (if it's not painfully obvious) as to why this is happening that's double-plus-helpful :D

Thanks!

amleto
20th June 2012, 19:59
dunno. exec() should make it visible.

tescrin
20th June 2012, 21:20
I decided to have the parent just call "Frameless window" on it. I assume that by using CustomizeWindowHint I was resetting something important?