summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-05-28 09:51:43 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-05-28 10:02:13 +0200
commit0bb0699d403b7541472a72a4057ecf0ca366a7cd (patch)
tree339b2151707e273f08d7249c877801587745339d /src/gui
parentb3be28bf199521546bc7890c66f8454f5d310083 (diff)
Use Qt::UniqueConnection instead of disconnect/connect
Also fix an issue in QTreeView where a signal could be connected several times Reviewed-by: Thierry
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qinputdialog.cpp3
-rw-r--r--src/gui/itemviews/qtreeview.cpp2
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp8
-rw-r--r--src/gui/widgets/qpushbutton.cpp3
4 files changed, 5 insertions, 11 deletions
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp
index 78d99e3837..8608334ccf 100644
--- a/src/gui/dialogs/qinputdialog.cpp
+++ b/src/gui/dialogs/qinputdialog.cpp
@@ -307,8 +307,7 @@ void QInputDialogPrivate::ensureEnabledConnection(QAbstractSpinBox *spinBox)
{
if (spinBox) {
QAbstractButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
- QObject::disconnect(spinBox, SIGNAL(textChanged(bool)), okButton, SLOT(setEnabled(bool)));
- QObject::connect(spinBox, SIGNAL(textChanged(bool)), okButton, SLOT(setEnabled(bool)));
+ QObject::connect(spinBox, SIGNAL(textChanged(bool)), okButton, SLOT(setEnabled(bool)), Qt::UniqueConnection);
}
}
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index c3fca8e061..7837700773 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -851,7 +851,7 @@ void QTreeView::setSortingEnabled(bool enable)
// because otherwise it will not call sort on the model.
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
- this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder)));
+ this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder)), Qt::UniqueConnection);
} else {
disconnect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder)));
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 1d6dc8a6e6..9a8f97e026 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -2702,14 +2702,10 @@ void QStyleSheetStyle::polish(QWidget *w)
QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled);
if ((rule.hasBorder() && rule.border()->hasBorderImage())
|| (rule.hasBackground() && !rule.background()->pixmap.isNull())) {
- QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
- QObject::disconnect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
QObject::connect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
+ sa, SLOT(update()), Qt::UniqueConnection);
QObject::connect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)),
- sa, SLOT(update()));
+ sa, SLOT(update()), Qt::UniqueConnection);
}
}
#endif
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index 03ca751271..ca58f87778 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -527,8 +527,7 @@ void QPushButton::setMenu(QMenu* menu)
return;
if (menu && !d->menu) {
- disconnect(this, SIGNAL(pressed()), this, SLOT(_q_popupPressed()));
- connect(this, SIGNAL(pressed()), this, SLOT(_q_popupPressed()));
+ connect(this, SIGNAL(pressed()), this, SLOT(_q_popupPressed()), Qt::UniqueConnection);
}
if (d->menu)
removeAction(d->menu->menuAction());