Summary: | KPDF - properties window doesn't fit | ||
---|---|---|---|
Product: | [Unmaintained] kpdf | Reporter: | Görkem Çetin <gorkem> |
Component: | general | Assignee: | Albert Astals Cid <aacid> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | RedHat Enterprise Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | An example of kpdf file properties window |
Description
Görkem Çetin
2005-03-21 19:04:07 UTC
Created attachment 10249 [details]
An example of kpdf file properties window
CVS commit by aacid: Fix for bug 102117 - properties window doesn't fit when some entry is too long Patch by Enrico Ros BUG: 102117 M +24 -9 propertiesdialog.cpp 1.5.4.1 --- kdegraphics/kpdf/ui/propertiesdialog.cpp #1.5:1.5.4.1 @@ -9,7 +9,9 @@ // qt/kde includes -#include <klocale.h> #include <qlayout.h> #include <qlabel.h> +#include <klocale.h> +#include <ksqueezedtextlabel.h> +#include <kglobalsettings.h> // local includes @@ -37,11 +39,16 @@ PropertiesDialog::PropertiesDialog(QWidg int row = 0; + int valMaxWidth = 100; for ( QDomNode node = docElement.firstChild(); !node.isNull(); node = node.nextSibling() ) { QDomElement element = node.toElement(); - if ( !element.attribute( "title" ).isEmpty() ) { - QLabel *key = new QLabel( i18n( "%1:" ).arg( element.attribute( "title" ) ), page ); - QLabel *value = new QLabel( element.attribute( "value" ), page ); + QString titleString = element.attribute( "title" ); + QString valueString = element.attribute( "value" ); + if ( titleString.isEmpty() || valueString.isEmpty() ) + continue; + // create labels and layout them + QLabel *key = new QLabel( i18n( "%1:" ).arg( titleString ), page ); + QLabel *value = new KSqueezedTextLabel( valueString, page ); layout->addWidget( key, row, 0, AlignRight ); layout->addWidget( value, row, 1 ); @@ -46,7 +53,8 @@ PropertiesDialog::PropertiesDialog(QWidg layout->addWidget( key, row, 0, AlignRight ); layout->addWidget( value, row, 1 ); - row++; - } + + // refine maximum width of 'value' labels + valMaxWidth = QMAX( valMaxWidth, fontMetrics().width( valueString ) ); } @@ -60,3 +68,10 @@ PropertiesDialog::PropertiesDialog(QWidg layout->addWidget( value, row, 1 ); } + + // current width: left columnt + right column + dialog borders + int width = layout->minimumSize().width() + valMaxWidth + 30; + // stay inside the 2/3 of the screen width + QRect screenContainer = KGlobalSettings::desktopGeometry( this ); + width = QMIN( width, 2*screenContainer.width()/3 ); + resize( width, 1 ); } |