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 seems to imply, but I still can't see the window. Here is the relevant code:
//synthkeypad.cpp
SynthKeypad
::SynthKeypad(QWidget *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);
}
//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);
}
To copy to clipboard, switch view to plain text mode
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->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,SLOT(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;
}
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,SLOT(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;
}
To copy to clipboard, switch view to plain text mode
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
Thanks!
Bookmarks