Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Sep 21, 2017
1 parent fef2d5a commit 4810438
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 60 deletions.
4 changes: 1 addition & 3 deletions src/plugins/miscellaneous/Core/src/busywidget.cpp
Expand Up @@ -409,7 +409,7 @@ void BusyWidget::paintEvent(QPaintEvent *pEvent)

painter.fillPath(painterPath, mBackgroundColor);

// Draw ourselves
// Draw ourselves and accept the event

if (mProgress == -1.0) {
double lineCornerRadius = mRoundness*(mThickness >> 1);
Expand Down Expand Up @@ -449,8 +449,6 @@ void BusyWidget::paintEvent(QPaintEvent *pEvent)
}
}

// Accept the event

pEvent->accept();
}

Expand Down
4 changes: 1 addition & 3 deletions src/plugins/miscellaneous/Core/src/progressbarwidget.cpp
Expand Up @@ -46,7 +46,7 @@ ProgressBarWidget::ProgressBarWidget(QWidget *pParent) :

void ProgressBarWidget::paintEvent(QPaintEvent *pEvent)
{
// Paint ourselves
// Draw ourselves and accept the event

QPainter painter(this);

Expand All @@ -62,8 +62,6 @@ void ProgressBarWidget::paintEvent(QPaintEvent *pEvent)
painter.fillRect(0, 0, width(), height(), windowColor());
}

// Accept the event

pEvent->accept();
}

Expand Down
20 changes: 1 addition & 19 deletions src/plugins/miscellaneous/Core/src/propertyeditorwidget.cpp
Expand Up @@ -76,16 +76,12 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *pEvent)

emit goToPreviousPropertyRequested();

// Accept the event

pEvent->accept();
} else if (noModifiers && (pEvent->key() == Qt::Key_Down)) {
// The user wants to go to the next property

emit goToNextPropertyRequested();

// Accept the event

pEvent->accept();
} else {
// Default handling of the event
Expand Down Expand Up @@ -141,16 +137,12 @@ void ListEditorWidget::keyPressEvent(QKeyEvent *pEvent)

emit goToPreviousPropertyRequested();

// Accept the event

pEvent->accept();
} else if (noModifiers && (pEvent->key() == Qt::Key_Down)) {
// The user wants to go to the next property

emit goToNextPropertyRequested();

// Accept the event

pEvent->accept();
} else {
// Default handling of the event
Expand Down Expand Up @@ -180,12 +172,10 @@ void ListEditorWidget::mouseDoubleClickEvent(QMouseEvent *pEvent)
newCurrentIndex = 0;
} while (itemText(newCurrentIndex).isEmpty());

// Set the new current index
// Set the new current index and accept the event

setCurrentIndex(newCurrentIndex);

// Accept the event

pEvent->accept();
}

Expand Down Expand Up @@ -1479,32 +1469,24 @@ void PropertyEditorWidget::keyPressEvent(QKeyEvent *pEvent)
else
editProperty(currentProperty());

// Accept the event

pEvent->accept();
} else if (noModifiers && (pEvent->key() == Qt::Key_Escape)) {
// The user wants to cancel the editing

finishEditing(false);

// Accept the event

pEvent->accept();
} else if (noModifiers && (pEvent->key() == Qt::Key_Up)) {
// The user wants to go the previous property

goToPreviousProperty();

// Accept the event

pEvent->accept();
} else if (noModifiers && (pEvent->key() == Qt::Key_Down)) {
// The user wants to go to the next property

goToNextProperty();

// Accept the event

pEvent->accept();
} else {
// Default handling of the event
Expand Down
8 changes: 0 additions & 8 deletions src/plugins/miscellaneous/Core/src/treeviewwidget.cpp
Expand Up @@ -132,8 +132,6 @@ void TreeViewWidget::keyPressEvent(QKeyEvent *pEvent)

setExpanded(crtIndex, false);

// Accept the event

pEvent->accept();
} else {
// Either the current item has no children or it is collapsed,
Expand All @@ -142,8 +140,6 @@ void TreeViewWidget::keyPressEvent(QKeyEvent *pEvent)
if (crtIndex.parent() != QModelIndex()) {
setCurrentIndex(crtIndex.parent());

// Accept the event

pEvent->accept();
} else {
// Default handling of the event
Expand All @@ -169,16 +165,12 @@ void TreeViewWidget::keyPressEvent(QKeyEvent *pEvent)

setExpanded(crtIndex, true);

// Accept the event

pEvent->accept();
} else {
// The current item is expanded, so select its first child

setCurrentIndex(crtIndex.model()->index(0, 0, crtIndex));

// Accept the event

pEvent->accept();
}
} else {
Expand Down
Expand Up @@ -395,8 +395,6 @@ void PmrWorkspacesWindowSynchronizeDialog::keyPressEvent(QKeyEvent *pEvent)
if (mButtonBox->button(QDialogButtonBox::Ok)->isEnabled())
acceptSynchronization();

// Accept the event

pEvent->accept();
} else {
// Default handling of the event
Expand Down
Expand Up @@ -592,8 +592,6 @@ void QScintillaWidget::keyPressEvent(QKeyEvent *pEvent)
// Carry on as normal, if the event wasn't handled

if (handled) {
// Accept the event

pEvent->accept();
} else {
// Reset the font size, if needed
Expand All @@ -605,21 +603,15 @@ void QScintillaWidget::keyPressEvent(QKeyEvent *pEvent)
if (pEvent->key() == Qt::Key_0) {
zoomTo(0);

// Accept the event

pEvent->accept();
} else if ( (pEvent->key() == Qt::Key_Plus)
|| (pEvent->key() == Qt::Key_Equal)) {
zoomIn();

// Accept the event

pEvent->accept();
} else if (pEvent->key() == Qt::Key_Minus) {
zoomOut();

// Accept the event

pEvent->accept();
} else {
// Default handling of the event
Expand Down
Expand Up @@ -409,17 +409,12 @@ void EditorWidgetFindReplaceWidget::keyPressEvent(QKeyEvent *pEvent)

emit keyPressed(pEvent, handled);

// Carry on as normal, if the event wasn't handled

if (handled) {
// Accept the event
// Accept the event or carry on as normal, if the event wasn't handled

if (handled)
pEvent->accept();
} else {
// Default handling of the event

else
Core::Widget::keyPressEvent(pEvent);
}
}

//==============================================================================
Expand Down
Expand Up @@ -499,12 +499,10 @@ void MathmlViewerWidget::paintEvent(QPaintEvent *pEvent)
0.5*(rect.height()-mathmlDocumentSize.height())));
}

// Enable/disable our copy to clipboard action
// Enable/disable our copy to clipboard action and accept the event

mCopyToClipboardAction->setEnabled(!mContents.isEmpty() && !mError);

// Accept the event

pEvent->accept();
}

Expand Down
8 changes: 2 additions & 6 deletions src/splashscreenwindow.cpp
Expand Up @@ -175,25 +175,21 @@ void SplashScreenWindow::closeAndDeleteAfter(QWidget *pWindow)

void SplashScreenWindow::closeEvent(QCloseEvent *pEvent)
{
// Accept the event
// Accept the event and ask for ourselves to be deleted later

pEvent->accept();

// Ask for ourselves to be deleted later

deleteLater();
}

//==============================================================================

void SplashScreenWindow::mousePressEvent(QMouseEvent *pEvent)
{
// Accept the event
// Accept the event and hide ourselves

pEvent->accept();

// Hide ourselves

hide();
}

Expand Down

0 comments on commit 4810438

Please sign in to comment.