Gui: Only measure with Quick Measure if showing in status bar
This commit is contained in:
@@ -2315,6 +2315,11 @@ void MainWindow::setRightSideMessage(const QString& message)
|
||||
d->rightSideLabel->setText(message.simplified());
|
||||
}
|
||||
|
||||
bool MainWindow::isRightSideMessageVisible() const
|
||||
{
|
||||
return d->rightSideLabel->isVisible();
|
||||
}
|
||||
|
||||
void MainWindow::showStatus(int type, const QString& message)
|
||||
{
|
||||
if(QApplication::instance()->thread() != QThread::currentThread()) {
|
||||
|
||||
@@ -266,6 +266,7 @@ public Q_SLOTS:
|
||||
|
||||
void showMessage (const QString & message, int timeout = 0);
|
||||
void setRightSideMessage(const QString & message);
|
||||
bool isRightSideMessageVisible() const;
|
||||
|
||||
// Set main window title
|
||||
void setWindowTitle(const QString& string);
|
||||
|
||||
@@ -114,18 +114,23 @@ void QuickMeasure::tryMeasureSelection()
|
||||
|
||||
bool QuickMeasure::shouldMeasure(const Gui::SelectionChanges& msg) const
|
||||
{
|
||||
if (!Gui::getMainWindow()->isRightSideMessageVisible()) {
|
||||
// don't measure if there's no where to show the result
|
||||
return false;
|
||||
}
|
||||
|
||||
// measure only IF
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
if (doc) {
|
||||
// we have a document
|
||||
if (msg.Type == Gui::SelectionChanges::AddSelection
|
||||
|| msg.Type == Gui::SelectionChanges::RmvSelection
|
||||
|| msg.Type == Gui::SelectionChanges::SetSelection
|
||||
|| msg.Type == Gui::SelectionChanges::ClrSelection) {
|
||||
// the event is about a change in selected objects
|
||||
return true;
|
||||
}
|
||||
if (!doc) {
|
||||
// no active document
|
||||
return false;
|
||||
}
|
||||
|
||||
if (msg.Type == Gui::SelectionChanges::AddSelection
|
||||
|| msg.Type == Gui::SelectionChanges::RmvSelection
|
||||
|| msg.Type == Gui::SelectionChanges::SetSelection
|
||||
|| msg.Type == Gui::SelectionChanges::ClrSelection) {
|
||||
// the event is about a change in selected objects
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user