I find that if I use it in just a mainwindow it will work fine. But as soon as that main window gets a frame in it the dialog will fail to stop at the border. I have been trying to figure it out and I just am confused right now.
I find that if I use it in just a mainwindow it will work fine. But as soon as that main window gets a frame in it the dialog will fail to stop at the border. I have been trying to figure it out and I just am confused right now.
Well, could you post the code in question?
Before I try to post all the code, (cause I am not sure what code is causing the issue) is there a way just to stop the mouse from having focus on the dialog box?
You could try disabling it by calling setFocusPolicy(Qt::NoFocus) in the dialog constructor, but I don't guarantee it will do too much.
alright...I am running out of ideas. I didn't think this would be this difficult. Other then the code I already posted here is the other code.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
lockedarea w;
w.show();
a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
return a.exec();
}
lockedarea::lockedarea(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
tmp *Tmp = new tmp(this);
Tmp->show();
}
lockedarea::~lockedarea()
{
tmp::tmp(QWidget *parent)
: LimitMovement(parent)
{
ui.setupUi(this);
//this->move(parent->pos());
mmm *ccc = new mmm(parent);
ccc->show();
}
tmp::~tmp()
{
}
mmm::mmm(QWidget *parent)
: LimitMovement(parent)
{
ui.setupUi(this);
}
mmm::~mmm()
{
}
LimitMovement::LimitMovement(QWidget *parent)
: QWidget()//parent)
{
parentSize = parent->frameGeometry().size();
parentPosition = parent->pos();
this->move(parentPosition.x()+(parentSize.width()/2),
parentPosition.y()+(parentSize.height()/2));
}
---That's all my code...there isn't much to the dialogs
How about a completely different approach? Because window frames including titlebar are not handled by Qt but the underlying system, how about implementing a custom titlebar to get full control over window movement?
J-P Nurmi
abbapatris (19th July 2007)
Thats a very good idea. Is there a tutorial or some documentation that could help with this that you know of?
Try following Brandybuck's suggestion:
http://www.qtcentre.org/forum/f-qt-p...s-3975.html#10
J-P Nurmi
Bookmarks