┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-10-10 22:29:05 +0000
committerPeter Penz <[email protected]>2009-10-10 22:29:05 +0000
commit984378d7f7227f2b195133b33084e09f0e682583 (patch)
treeb73e4e0990484f3f5d0575328e218719752a5046 /src
parentb786c28e0431e01c5938a824709046fa149a6977 (diff)
layout improvements
svn path=/trunk/KDE/kdebase/apps/; revision=1033744
Diffstat (limited to 'src')
-rw-r--r--src/panels/information/commentwidget.cpp2
-rw-r--r--src/panels/information/informationpanelcontent.cpp20
-rw-r--r--src/panels/information/metadatawidget.cpp17
-rw-r--r--src/panels/information/taggingwidget.cpp2
4 files changed, 34 insertions, 7 deletions
diff --git a/src/panels/information/commentwidget.cpp b/src/panels/information/commentwidget.cpp
index 6397bc39a..173a2ee6d 100644
--- a/src/panels/information/commentwidget.cpp
+++ b/src/panels/information/commentwidget.cpp
@@ -21,6 +21,7 @@
#include "commentwidget_p.h"
#include <kdialog.h>
+#include <kglobalsettings.h>
#include <klocale.h>
#include <QLabel>
@@ -33,6 +34,7 @@ CommentWidget::CommentWidget(QWidget* parent) :
m_comment()
{
m_label = new QLabel(this);
+ m_label->setFont(KGlobalSettings::smallestReadableFont());
connect(m_label, SIGNAL(linkActivated(const QString&)), this, SLOT(slotLinkActivated(const QString&)));
QVBoxLayout* layout = new QVBoxLayout(this);
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index 4ddbf6562..5431b8ed3 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -117,9 +117,20 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
m_previewSeparator->setVisible(showPreview);
m_metaDataWidget = new MetaDataWidget(parent);
+ m_metaDataWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+
+ // Encapsulate the MetaDataWidget inside a container that has a dummy widget
+ // at the bottom. This prevents that the meta data widget gets vertically stretched
+ // in the case where the height of m_metaDataArea > m_metaDataWidget.
+ QWidget* metaDataWidgetContainer = new QWidget(parent);
+ QVBoxLayout* containerLayout = new QVBoxLayout(metaDataWidgetContainer);
+ containerLayout->setContentsMargins(0, 0, 0, 0);
+ containerLayout->setSpacing(0);
+ containerLayout->addWidget(m_metaDataWidget);
+ containerLayout->addWidget(new QWidget(metaDataWidgetContainer));
m_metaDataArea = new QScrollArea(parent);
- //m_metaDataArea->setWidget(m_metaDataArea);
+ m_metaDataArea->setWidget(metaDataWidgetContainer);
m_metaDataArea->setWidgetResizable(true);
m_metaDataArea->setFrameShape(QFrame::NoFrame);
@@ -135,9 +146,6 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) :
layout->addWidget(m_preview);
layout->addWidget(m_phononWidget);
layout->addWidget(m_previewSeparator);
- if (m_metaDataWidget != 0) {
- layout->addWidget(m_metaDataWidget);
- }
layout->addWidget(m_metaDataArea);
parent->setLayout(layout);
}
@@ -238,7 +246,7 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event)
if (obj == m_metaDataArea->viewport()) {
// The size of the meta text area has changed. Adjust the fixed
// width in a way that no horizontal scrollbar needs to be shown.
- //m_metaDataWidget->setFixedWidth(resizeEvent->size().width());
+ m_metaDataWidget->setFixedWidth(resizeEvent->size().width());
} else if (obj == parent()) {
// If the text inside the name label or the info label cannot
// get wrapped, then the maximum width of the label is increased
@@ -251,7 +259,7 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event)
// The metadata widget also contains a text widget which may return
// a large preferred width.
if (m_metaDataWidget != 0) {
- //m_metaDataWidget->setMaximumWidth(maxWidth);
+ m_metaDataWidget->setMaximumWidth(maxWidth);
}
// try to increase the preview as large as possible
diff --git a/src/panels/information/metadatawidget.cpp b/src/panels/information/metadatawidget.cpp
index 30bdb904f..d4d431935 100644
--- a/src/panels/information/metadatawidget.cpp
+++ b/src/panels/information/metadatawidget.cpp
@@ -21,6 +21,7 @@
#include "metadatawidget.h"
#include <kfileitem.h>
+#include <kglobalsettings.h>
#include <klocale.h>
#include <QGridLayout>
@@ -155,6 +156,8 @@ MetaDataWidget::Private::Private(MetaDataWidget* parent) :
q(parent)
{
m_gridLayout = new QGridLayout(parent);
+ m_gridLayout->setContentsMargins(0, 0, 0, 0);
+ m_gridLayout->setSpacing(0);
m_typeInfo = new QLabel(parent);
m_sizeLabel = new QLabel(parent);
@@ -198,12 +201,21 @@ void MetaDataWidget::Private::addRow(QLabel* label, QWidget* infoWidget)
row.infoWidget = infoWidget;
m_rows.append(row);
- // use a brighter color for the label
+ // use a brighter color for the label and a small font size
QPalette palette = label->palette();
QColor textColor = palette.color(QPalette::Text);
textColor.setAlpha(128);
palette.setColor(QPalette::WindowText, textColor);
label->setPalette(palette);
+ label->setFont(KGlobalSettings::smallestReadableFont());
+ label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+
+ QLabel* infoLabel = qobject_cast<QLabel*>(infoWidget);
+ if (infoLabel != 0) {
+ infoLabel->setFont(KGlobalSettings::smallestReadableFont());
+ infoLabel->setWordWrap(true);
+ infoLabel->setAlignment(Qt::AlignTop | Qt::AlignRight);
+ }
// add the row to grid layout
const int rowIndex = m_rows.count();
@@ -254,6 +266,9 @@ void MetaDataWidget::Private::slotLoadingFinished()
}
++index;
}
+ if (metaInfoCount > 0) {
+ --index;
+ }
// remove rows that are not needed anymore
for (int i = rowCount - 1; i > index; --i) {
diff --git a/src/panels/information/taggingwidget.cpp b/src/panels/information/taggingwidget.cpp
index 7c9616d95..90252d410 100644
--- a/src/panels/information/taggingwidget.cpp
+++ b/src/panels/information/taggingwidget.cpp
@@ -19,6 +19,7 @@
#include "taggingwidget_p.h"
+#include <kglobalsettings.h>
#include <klocale.h>
#include <QLabel>
@@ -31,6 +32,7 @@ TaggingWidget::TaggingWidget(QWidget* parent) :
m_tagsText()
{
m_label = new QLabel(this);
+ m_label->setFont(KGlobalSettings::smallestReadableFont());
connect(m_label, SIGNAL(linkActivated(const QString&)), this, SLOT(slotLinkActivated(const QString&)));
QVBoxLayout* layout = new QVBoxLayout(this);