Fix incorrect positions and heights in open/save dialogs when nonstandard font sizes are in use

pull/16/head
Timothy Pearson 11 years ago
parent 857fae6c4f
commit c5463fddb1

@ -214,10 +214,12 @@ void KURLBarItem::paint( TQPainter *p )
p->drawPixmap( margin, yPos, *pm ); p->drawPixmap( margin, yPos, *pm );
if ( !text().isEmpty() ) { if ( !text().isEmpty() ) {
TQFontMetrics fm = p->fontMetrics(); TQFontMetrics fm = p->fontMetrics();
if ( pm->height() < fm.height() ) if ( pm->height() < fm.height() ) {
yPos = fm.ascent() + fm.leading()/2; yPos = fm.ascent() + fm.leading()/2;
else }
yPos = pm->height()/2 - fm.height()/2 + fm.ascent(); else {
yPos = height(box)/2 - fm.height()/2 + fm.ascent() - margin;
}
yPos += margin; yPos += margin;
int stringWidth = box->width() - pm->width() - 2 - (margin * 2); int stringWidth = box->width() - pm->width() - 2 - (margin * 2);

@ -540,18 +540,18 @@ void TDEIconViewItem::calcRect( const TQString& text_ )
tw = view->maxItemWidth() - ( view->itemTextPos() == TQIconView::Bottom ? 0 : tw = view->maxItemWidth() - ( view->itemTextPos() == TQIconView::Bottom ? 0 :
itemIconRect.width() ); itemIconRect.width() );
} }
TQFontMetrics *fm = view->itemFontMetrics(); TQFontMetrics *fm = view->itemFontMetrics();
TQString t; TQString t;
TQRect r; TQRect r;
// When is text_ set ? Doesn't look like it's ever set. // When is text_ set ? Doesn't look like it's ever set.
t = text_.isEmpty() ? text() : text_; t = text_.isEmpty() ? text() : text_;
// Max text height // Max text height
int nbLines = static_cast<TDEIconView*>( iconView() )->iconTextHeight(); int nbLines = static_cast<TDEIconView*>( iconView() )->iconTextHeight();
int height = nbLines > 0 ? fm->height() * nbLines : 0xFFFFFFFF; int height = nbLines > 0 ? fm->height() * nbLines : 0xFFFFFFFF;
// Should not be higher than pixmap if text is alongside icons // Should not be higher than pixmap if text is alongside icons
if ( view->itemTextPos() != TQIconView::Bottom ) { if ( view->itemTextPos() != TQIconView::Bottom ) {
if ( d && !d->m_pixmapSize.isNull() ) if ( d && !d->m_pixmapSize.isNull() )
@ -560,7 +560,7 @@ void TDEIconViewItem::calcRect( const TQString& text_ )
height = QMIN( itemIconRect.height(), height ); height = QMIN( itemIconRect.height(), height );
height = QMAX( height, fm->height() ); height = QMAX( height, fm->height() );
} }
// Calculate the word-wrap // Calculate the word-wrap
TQRect outerRect( 0, 0, tw - 6, height ); TQRect outerRect( 0, 0, tw - 6, height );
m_wordWrap = KWordWrap::formatText( *fm, outerRect, 0, t ); m_wordWrap = KWordWrap::formatText( *fm, outerRect, 0, t );
@ -634,8 +634,8 @@ void TDEIconViewItem::calcRect( const TQString& text_ )
} }
if ( ( itemIconRect.height() <= 20 ) && ( itemTextRect.height() < itemIconRect.height() ) ) { if ( ( itemIconRect.height() <= 20 ) && ( itemTextRect.height() < itemIconRect.height() ) ) {
d->realTextHeight = itemTextRect.height(); d->realTextHeight = itemTextRect.height();
itemTextRect.setHeight( itemIconRect.height() - 2 );
itemTextRect.setY( itemIconRect.y() ); itemTextRect.setY( itemIconRect.y() );
itemTextRect.setHeight( itemIconRect.height() - 2 );
} }
} }

@ -85,7 +85,7 @@ KSystemTray::KSystemTray( TQWidget* parent, const char* name )
TQT_TQOBJECT(this), TQT_SLOT( minimizeRestoreAction() ), TQT_TQOBJECT(this), TQT_SLOT( minimizeRestoreAction() ),
d->actionCollection, "minimizeRestore"); d->actionCollection, "minimizeRestore");
#ifdef Q_WS_X11 #ifdef Q_WS_X11
KWin::WindowInfo info = KWin::windowInfo( parentWidget()->winId()); KWin::WindowInfo info = KWin::windowInfo( parentWidget()->winId() );
d->on_all_desktops = info.onAllDesktops(); d->on_all_desktops = info.onAllDesktops();
#else #else
d->on_all_desktops = false; d->on_all_desktops = false;

Loading…
Cancel
Save