Skip to content

Commit

Permalink
Fix: Should hidden the Top Level QWidget in some case
Browse files Browse the repository at this point in the history
  • Loading branch information
lenky0401 committed Sep 13, 2013
1 parent 28da04e commit b57adbe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ void MainController::init()
mSystemTray->setToolTip("fcitx-qimpanel");
mSystemTray->show();

mTopLevel->setVisible(true);

QObject::connect(mAgent,
SIGNAL(updateProperty(KimpanelProperty)), this,
SLOT(updateProperty(KimpanelProperty)));
Expand Down Expand Up @@ -233,11 +231,13 @@ void MainController::updateSpotRect(int x, int y, int w, int h)
void MainController::showPreedit(bool to_show)
{
mModel->setShowPreedit(to_show);
mTopLevel->setTopLevelVisible(mModel->showTips(), mModel->showPreedit(), mModel->showLookupTable());
}

void MainController::showAux(bool to_show)
{
mModel->setShowTips(to_show);
mTopLevel->setTopLevelVisible(mModel->showTips(), mModel->showPreedit(), mModel->showLookupTable());
}

void MainController::updateAux(const QString &text, const QList<TextAttribute> &attr)
Expand All @@ -248,6 +248,7 @@ void MainController::updateAux(const QString &text, const QList<TextAttribute> &
void MainController::showLookupTable(bool to_show)
{
mModel->setShowLookupTable(to_show);
mTopLevel->setTopLevelVisible(mModel->showTips(), mModel->showPreedit(), mModel->showLookupTable());
}

void MainController::updateLookupTableCursor(int pos)
Expand Down
5 changes: 5 additions & 0 deletions toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ void TopLevel::updateLocation()
if (p != pos())
move(p);
}

void TopLevel::setTopLevelVisible(bool aux, bool preedit, bool lookupTable)
{
this->setVisible(aux || preedit || lookupTable);
}
2 changes: 2 additions & 0 deletions toplevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class TopLevel : public QWidget
virtual void resizeEvent(QResizeEvent* resize);
virtual bool eventFilter(QObject* object, QEvent* event);
void setSpotRect(const QRect& rect);
void setTopLevelVisible(bool aux, bool preedit, bool lookupTable);

private:
void updateLocation();

Expand Down

0 comments on commit b57adbe

Please sign in to comment.