bug-fix: update status after edit tab got focus

This commit is contained in:
Le Tan 2017-10-18 19:54:38 +08:00
parent 00feaa13e2
commit 5aa5864ced
4 changed files with 7 additions and 3 deletions

View File

@ -25,6 +25,7 @@ void VEditTab::focusTab()
{ {
focusChild(); focusChild();
emit getFocused(); emit getFocused();
updateStatus();
} }
bool VEditTab::isEditMode() const bool VEditTab::isEditMode() const
@ -49,8 +50,10 @@ void VEditTab::handleFocusChanged(QWidget * /* p_old */, QWidget *p_now)
focusChild(); focusChild();
emit getFocused(); emit getFocused();
updateStatus();
} else if (isAncestorOf(p_now)) { } else if (isAncestorOf(p_now)) {
emit getFocused(); emit getFocused();
updateStatus();
} }
} }

View File

@ -265,8 +265,8 @@ int VEditWindow::insertEditTab(int p_index, VFile *p_file, QWidget *p_page)
{ {
int idx = insertTab(p_index, int idx = insertTab(p_index,
p_page, p_page,
generateTabText(p_index, p_file)); p_file->getName());
setTabToolTip(idx, generateTooltip(p_file)); updateTabInfo(idx);
return idx; return idx;
} }

View File

@ -153,6 +153,7 @@ private:
// and move the tab to the new split. // and move the tab to the new split.
void moveTabOneSplit(int p_tabIdx, bool p_right); void moveTabOneSplit(int p_tabIdx, bool p_right);
// Update info of tab @p_idx according to the state of the editor and file.
void updateTabInfo(int p_idx); void updateTabInfo(int p_idx);
// Update the sequence number of all the tabs. // Update the sequence number of all the tabs.

View File

@ -1155,7 +1155,7 @@ void VMainWindow::initEditMenu()
void VMainWindow::initDockWindows() void VMainWindow::initDockWindows()
{ {
toolDock = new QDockWidget(tr("Tools"), this); toolDock = new QDockWidget(tr("Tools"), this);
toolDock->setObjectName("tools_dock"); toolDock->setObjectName("ToolsDock");
toolDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); toolDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
toolBox = new QToolBox(this); toolBox = new QToolBox(this);