┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/tooltips/filemetadatatooltip.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-08-02 06:39:36 +0000
committerPeter Penz <[email protected]>2010-08-02 06:39:36 +0000
commit959642ace563d59d5fada0961fd4c79c55fccff6 (patch)
tree05d812cb4881a113e9d74c6e641470574a3cd6b0 /src/views/tooltips/filemetadatatooltip.cpp
parent7ad7aefbf1ef0efc044b6af8f65327e386632ff9 (diff)
Remove the workaround to show the tooltip temporary on a hidden position, to have a valid layout. Based on Maciej Mrozowski's patch this is now done by postponing the showing of the tooltip until the meta-data and the preview has been received.
CCBUG: 245491 svn path=/trunk/KDE/kdebase/apps/; revision=1158057
Diffstat (limited to 'src/views/tooltips/filemetadatatooltip.cpp')
-rw-r--r--src/views/tooltips/filemetadatatooltip.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp
index d6e0c36aa..f1b09a747 100644
--- a/src/views/tooltips/filemetadatatooltip.cpp
+++ b/src/views/tooltips/filemetadatatooltip.cpp
@@ -20,10 +20,10 @@
#include "filemetadatatooltip.h"
-#include <kcolorscheme.h>
+#include <KColorScheme>
#include <kfilemetadatawidget.h>
-#include <kseparator.h>
-#include <kwindowsystem.h>
+#include <KSeparator>
+#include <KWindowSystem>
#include <QLabel>
#include <QPainter>
@@ -34,7 +34,6 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
m_preview(0),
m_name(0),
m_fileMetaDataWidget(0)
-
{
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint);
@@ -47,30 +46,25 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) :
QFont font = m_name->font();
font.setBold(true);
m_name->setFont(font);
- m_name->setAlignment(Qt::AlignHCenter);
// Create widget for the meta data
m_fileMetaDataWidget = new KFileMetaDataWidget();
m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText);
m_fileMetaDataWidget->setReadOnly(true);
+ connect(m_fileMetaDataWidget, SIGNAL(metaDataRequestFinished()),
+ this, SIGNAL(metaDataRequestFinished()));
- // The stretchwidget allows the metadata widget to be top aligned and fills
- // the remaining vertical space
- QWidget* stretchWidget = new QWidget(this);
- stretchWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
-
- QWidget* textContainer = new QWidget(this);
- QVBoxLayout* textLayout = new QVBoxLayout(textContainer);
+ QVBoxLayout* textLayout = new QVBoxLayout();
+ textLayout->setAlignment(Qt::AlignTop);
textLayout->addWidget(m_name);
textLayout->addWidget(new KSeparator());
textLayout->addWidget(m_fileMetaDataWidget);
- textLayout->addWidget(stretchWidget);
+ textLayout->setAlignment(m_name, Qt::AlignCenter);
+ textLayout->setAlignment(m_fileMetaDataWidget, Qt::AlignLeft);
QHBoxLayout* tipLayout = new QHBoxLayout(this);
tipLayout->addWidget(m_preview);
- tipLayout->addWidget(textContainer);
-
- tipLayout->setSizeConstraint(QLayout::SetFixedSize);
+ tipLayout->addLayout(textLayout);
}
FileMetaDataToolTip::~FileMetaDataToolTip()
@@ -82,9 +76,12 @@ void FileMetaDataToolTip::setPreview(const QPixmap& pixmap)
m_preview->setPixmap(pixmap);
}
-const QPixmap* FileMetaDataToolTip::preview() const
+QPixmap FileMetaDataToolTip::preview() const
{
- return m_preview->pixmap();
+ if (m_preview->pixmap() != 0) {
+ return *m_preview->pixmap();
+ }
+ return QPixmap();
}
void FileMetaDataToolTip::setName(const QString& name)