]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix issue that tooltip-labels might get clipped (this regression has been introduced...
authorPeter Penz <peter.penz19@gmail.com>
Tue, 28 Sep 2010 15:58:14 +0000 (15:58 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Tue, 28 Sep 2010 15:58:14 +0000 (15:58 +0000)
CCBUG: 241608

svn path=/trunk/KDE/kdebase/apps/; revision=1180693

src/views/tooltips/filemetadatatooltip.cpp

index 60efa3e9662a2e24d8a089c210c5c2cef46dee2e..a9cc2c1633c0af65d8614ebc5d5dbe2e94c48d68 100644 (file)
@@ -40,6 +40,7 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
 
     // Create widget for file preview
     m_preview = new QLabel(this);
 
     // Create widget for file preview
     m_preview = new QLabel(this);
+    m_preview->setAlignment(Qt::AlignTop);
 
     // Create widget for file name
     m_name = new QLabel(this);
 
     // Create widget for file name
     m_name = new QLabel(this);
@@ -55,15 +56,20 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
             this, SIGNAL(metaDataRequestFinished(KFileItemList)));
 
     QVBoxLayout* textLayout = new QVBoxLayout();
             this, SIGNAL(metaDataRequestFinished(KFileItemList)));
 
     QVBoxLayout* textLayout = new QVBoxLayout();
-    textLayout->setAlignment(Qt::AlignTop);
     textLayout->addWidget(m_name);
     textLayout->addWidget(new KSeparator());
     textLayout->addWidget(m_fileMetaDataWidget);
     textLayout->setAlignment(m_name, Qt::AlignCenter);
     textLayout->setAlignment(m_fileMetaDataWidget, Qt::AlignLeft);
     textLayout->addWidget(m_name);
     textLayout->addWidget(new KSeparator());
     textLayout->addWidget(m_fileMetaDataWidget);
     textLayout->setAlignment(m_name, Qt::AlignCenter);
     textLayout->setAlignment(m_fileMetaDataWidget, Qt::AlignLeft);
+    // Assure that the text-layout gets top-aligned by adding a stretch.
+    // Don't use textLayout->setAlignment(Qt::AlignTop) instead, as this does
+    // not work with the heightForWidth()-size-hint of m_fileMetaDataWidget
+    // (see bug #241608)
+    textLayout->addStretch();
 
     QHBoxLayout* tipLayout = new QHBoxLayout(this);
     tipLayout->addWidget(m_preview);
 
     QHBoxLayout* tipLayout = new QHBoxLayout(this);
     tipLayout->addWidget(m_preview);
+    tipLayout->addSpacing(tipLayout->margin());
     tipLayout->addLayout(textLayout);
 }
 
     tipLayout->addLayout(textLayout);
 }