我通常的做法是:
建立一个系统托盘QSystemTrayIcon,实现右键弹出式菜单,菜单中有一项为Show/Hide。然后:
void MyWidget::createAction()
{
...
showHideAction=new QAction(tr("ShowMainWindow"),this);
showHideAction->setShortcut(tr("F4"));    // 在这里还可以设置相应的快捷键哦!
connect(showHideAction, SIGNAL(triggered()), this, SLOT(showHideMyWidget()));
...
myMenu->addAction(showHideAction);
}
......
void MyWidget::showHideMyWidget()
{
    if (isVisible()) { 
        hide();
        showHideAction->setText(tr("Show"));
    } else {
        show();
        activateWindow();
        showHideAction>setText(tr("Hide"));
    }
}
更多可以查看:void QWidget::show ()   [slot]  
                            void QWidget::hide ()   [slot]
                            bool    isVisible () const
都是QWidget提供的成员函数。