summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnar Thomsen <rthomsen6@gmail.com>2016-11-29 17:59:35 (GMT)
committerRagnar Thomsen <rthomsen6@gmail.com>2016-11-29 18:02:39 (GMT)
commit7a5e4e4c402e64ef5815e7bc10d9efb6468846a9 (patch)
tree9eda9b51ef2ef70bc13ab19bc4b284bc6f73075e
parent1b817f61f187eda4dc14a3227e0c0430c30d808e (diff)
Fix resizing of infopanel
KSqueezedTextLabel doesn't rich text. This causes the used <b> and </b> tags to sometimes become visible when the infopanel is reduced in size. This is fixed by splitting the text into two parts: The left-most is a QLabel (because it has predictable horizontal size) which holds the title and the right-most is a KSqueezedTextLLabel and holds the value. The left-side one can then be set to bold font. Differential Revision: D3523
-rw-r--r--part/infopanel.cpp17
-rw-r--r--part/infopanel.ui112
2 files changed, 108 insertions, 21 deletions
diff --git a/part/infopanel.cpp b/part/infopanel.cpp
index d61d292..1fb1098 100644
--- a/part/infopanel.cpp
+++ b/part/infopanel.cpp
@@ -175,33 +175,40 @@ void InfoPanel::showMetaDataFor(const QModelIndex &index)
mimeType = db.mimeTypeForFile(entry->fullPath(), QMimeDatabase::MatchExtension);
}
- m_typeLabel->setText(i18n("<b>Type:</b> %1", mimeType.comment()));
+ m_typeValueLabel->setText(mimeType.comment());
if (!entry->property("owner").toString().isEmpty()) {
m_ownerLabel->show();
- m_ownerLabel->setText(i18n("<b>Owner:</b> %1", entry->property("owner").toString()));
+ m_ownerValueLabel->show();
+ m_ownerValueLabel->setText(entry->property("owner").toString());
} else {
m_ownerLabel->hide();
+ m_ownerValueLabel->hide();
}
if (!entry->property("group").toString().isEmpty()) {
m_groupLabel->show();
- m_groupLabel->setText(i18n("<b>Group:</b> %1", entry->property("group").toString()));
+ m_groupValueLabel->show();
+ m_groupValueLabel->setText(entry->property("group").toString());
} else {
m_groupLabel->hide();
+ m_groupValueLabel->hide();
}
if (!entry->property("link").toString().isEmpty()) {
m_targetLabel->show();
- m_targetLabel->setText(i18n("<b>Target:</b> %1", entry->property("link").toString()));
+ m_targetValueLabel->show();
+ m_targetValueLabel->setText(entry->property("link").toString());
} else {
m_targetLabel->hide();
+ m_targetValueLabel->hide();
}
if (entry->property("isPasswordProtected").toBool()) {
m_passwordLabel->show();
- m_passwordLabel->setText(i18n("<b>Password protected:</b> Yes"));
+ m_passwordValueLabel->show();
} else {
m_passwordLabel->hide();
+ m_passwordValueLabel->hide();
}
}
diff --git a/part/infopanel.ui b/part/infopanel.ui
index 1d99966..54120ee 100644
--- a/part/infopanel.ui
+++ b/part/infopanel.ui
@@ -80,39 +80,119 @@
</item>
<item>
<widget class="QWidget" name="m_metaDataWidget" native="true">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="KSqueezedTextLabel" name="m_typeLabel">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="m_typeLabel">
<property name="text">
- <string notr="true">KSqueezedTextLabel</string>
+ <string>Type:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item>
- <widget class="KSqueezedTextLabel" name="m_ownerLabel">
+ <item row="0" column="1">
+ <widget class="KSqueezedTextLabel" name="m_typeValueLabel">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="m_ownerLabel">
<property name="text">
- <string notr="true">KSqueezedTextLabel</string>
+ <string>Owner:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item>
- <widget class="KSqueezedTextLabel" name="m_groupLabel">
+ <item row="1" column="1">
+ <widget class="KSqueezedTextLabel" name="m_ownerValueLabel">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="m_groupLabel">
<property name="text">
- <string notr="true">KSqueezedTextLabel</string>
+ <string>Group:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item>
- <widget class="KSqueezedTextLabel" name="m_targetLabel">
+ <item row="2" column="1">
+ <widget class="KSqueezedTextLabel" name="m_groupValueLabel">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="m_targetLabel">
+ <property name="text">
+ <string>Target:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="KSqueezedTextLabel" name="m_targetValueLabel">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="m_passwordLabel">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
<property name="text">
- <string notr="true">KSqueezedTextLabel</string>
+ <string>Password-protected:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item>
- <widget class="KSqueezedTextLabel" name="m_passwordLabel">
+ <item row="4" column="1">
+ <widget class="KSqueezedTextLabel" name="m_passwordValueLabel">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
<property name="text">
- <string notr="true">KSqueezedTextLabel</string>
+ <string>yes</string>
</property>
</widget>
</item>