Nyx
18th June 2010, 16:34
Hi ,
I am looking how I could use a QShortcut to make my main QWidget appear and disappear. I tried this but it only hide the widget I can't show() it again by the same shortcut:
void ULmain::upShwHide()
{
if(m_visible)
{
//this->QWidget::hide();
setVisible(true);
m_visible = false;
}
else
{
//this->QWidget::show();
setVisible(true);
m_visible = true;
}
}
I declared in my class constructor:
QShortcut * shwHide = new QShortcut(QKeySequence("Ctrl+Space"), this);
and connect:
QObject::connect(shwHide, SIGNAL(activated()), this, SLOT(upShwHide()));
I thought about a systemtray application but it doesn't seems to work.
I am looking how I could use a QShortcut to make my main QWidget appear and disappear. I tried this but it only hide the widget I can't show() it again by the same shortcut:
void ULmain::upShwHide()
{
if(m_visible)
{
//this->QWidget::hide();
setVisible(true);
m_visible = false;
}
else
{
//this->QWidget::show();
setVisible(true);
m_visible = true;
}
}
I declared in my class constructor:
QShortcut * shwHide = new QShortcut(QKeySequence("Ctrl+Space"), this);
and connect:
QObject::connect(shwHide, SIGNAL(activated()), this, SLOT(upShwHide()));
I thought about a systemtray application but it doesn't seems to work.