diff widgets/SelectableLabel.cpp @ 441:f8fcfbe13c8f

* Avoid waiting on uninstalled transforms mutex in TransformFactory:: getTransformInstallStatus -- we can return TransformUnknown * Don't follow link in SelectableLabel when clicking to select it * Restore lost version number in plugin param dialog
author Chris Cannam
date Tue, 28 Oct 2008 18:06:06 +0000
parents 4a5fe5471282
children 1a0dfcbffaf1
line wrap: on
line diff
--- a/widgets/SelectableLabel.cpp	Tue Oct 28 12:39:53 2008 +0000
+++ b/widgets/SelectableLabel.cpp	Tue Oct 28 18:06:06 2008 +0000
@@ -26,6 +26,7 @@
 //    setLineWidth(2);
 //    setFixedWidth(480);
     setupStyle();
+    setOpenExternalLinks(true);
 }
 
 SelectableLabel::~SelectableLabel()
@@ -59,6 +60,10 @@
 {
     QPalette palette = QApplication::palette();
 
+    setTextInteractionFlags(Qt::LinksAccessibleByKeyboard |
+                            Qt::LinksAccessibleByMouse |
+                            Qt::TextSelectableByMouse);
+
     if (m_selected) {
         setWordWrap(true);
         setStyleSheet
@@ -77,8 +82,6 @@
              .arg(palette.button().color().name())
              .arg(palette.light().color().name())
              .arg(palette.text().color().name()));
-
-//        setStyleSheet("QLabel:hover { background: #e0e0e0; color: black; } QLabel:!hover { background: white; color: black } QLabel { padding: 7px }");
     }
 }    
 
@@ -105,18 +108,27 @@
 void
 SelectableLabel::mousePressEvent(QMouseEvent *e)
 {
+    m_swallowRelease = !m_selected;
     setSelected(true);
+    QLabel::mousePressEvent(e);
     emit selectionChanged();
 }
 
 void
 SelectableLabel::mouseDoubleClickEvent(QMouseEvent *e)
 {
-    std::cerr << "mouseDoubleClickEvent" << std::endl;
+    QLabel::mouseDoubleClickEvent(e);
     emit doubleClicked();
 }
 
 void
+SelectableLabel::mouseReleaseEvent(QMouseEvent *e)
+{
+    if (!m_swallowRelease) QLabel::mouseReleaseEvent(e);
+    m_swallowRelease = false;
+}
+
+void
 SelectableLabel::enterEvent(QEvent *)
 {
 //    std::cerr << "enterEvent" << std::endl;