Asperamanca
21st July 2010, 17:34
Hi,
I have a toggle action that should call a function within my class when toggled.
However, it does not, and I have no idea why not.
Could someone please take a look?
In my widget constructor:
...
QAction *topmostAction = new QAction("Stay on &Top", this);
topmostAction->setShortcut(QKeySequence("Ctrl+T"));
topmostAction->setCheckable(true);
topmostAction->setChecked(false);
connect(topmostAction, SIGNAL(toggled(bool)),
this, SLOT(setTopmost(bool)));
addAction(topmostAction);
...
and later on the function that should be called:
void OvenTimerWidget::setTopmost(bool bTopmost)
{
Qt::WindowFlags flags;
flags = windowFlags();
if (bTopmost)
flags |= Qt::WindowStaysOnTopHint;
else
flags &= (!Qt::WindowStaysOnTopHint);
setWindowFlags(flags);
emit topmostChanged(bTopmost);
}
I have my breakpoint in there, click on the (context) menu entry, it gets checked, but I never reach the breakpoint. What could be wrong here?
Thanks!
I have a toggle action that should call a function within my class when toggled.
However, it does not, and I have no idea why not.
Could someone please take a look?
In my widget constructor:
...
QAction *topmostAction = new QAction("Stay on &Top", this);
topmostAction->setShortcut(QKeySequence("Ctrl+T"));
topmostAction->setCheckable(true);
topmostAction->setChecked(false);
connect(topmostAction, SIGNAL(toggled(bool)),
this, SLOT(setTopmost(bool)));
addAction(topmostAction);
...
and later on the function that should be called:
void OvenTimerWidget::setTopmost(bool bTopmost)
{
Qt::WindowFlags flags;
flags = windowFlags();
if (bTopmost)
flags |= Qt::WindowStaysOnTopHint;
else
flags &= (!Qt::WindowStaysOnTopHint);
setWindowFlags(flags);
emit topmostChanged(bTopmost);
}
I have my breakpoint in there, click on the (context) menu entry, it gets checked, but I never reach the breakpoint. What could be wrong here?
Thanks!