diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-23 17:13:36 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-23 17:13:36 -0500 |
commit | d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5 (patch) | |
tree | baeeba639393f46abab749f4700a250091c3cc16 /tqtinterface/qt4/src/widgets/tqmenubar.cpp | |
parent | d7be1694839bacae31e500ea9e36b3c13257ce28 (diff) | |
download | experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.tar.gz experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.zip |
Apply all Qt3.3.8d patches
NOTE: This will *likely* break compilation of TQt4
Please wait a few days for fixes to be committed as needed!
Diffstat (limited to 'tqtinterface/qt4/src/widgets/tqmenubar.cpp')
-rw-r--r-- | tqtinterface/qt4/src/widgets/tqmenubar.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/tqtinterface/qt4/src/widgets/tqmenubar.cpp b/tqtinterface/qt4/src/widgets/tqmenubar.cpp index aadb3ee..c8fed6d 100644 --- a/tqtinterface/qt4/src/widgets/tqmenubar.cpp +++ b/tqtinterface/qt4/src/widgets/tqmenubar.cpp @@ -231,6 +231,10 @@ static const int motifItemFrame = 2; // menu item frame width static const int motifItemHMargin = 5; // menu item hor text margin static const int motifItemVMargin = 4; // menu item ver text margin +// The others are 0 +static const int gtkItemHMargin = 8; +static const int gtkItemVMargin = 8; + /* +----------------------------- @@ -295,7 +299,14 @@ TQMenuBar::TQMenuBar( TQWidget *tqparent, const char *name ) setFrameStyle( TQFrame::MenuBarPanel | TQFrame::Raised ); TQFontMetrics fm = fontMetrics(); - int h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame; + + int h; + int gs = style().tqstyleHint(TQStyle::SH_GUIStyle); + if (gs == GtkStyle) { + h = fm.height() + gtkItemVMargin; + } else { + h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame; + } setGeometry( 0, 0, width(), h ); @@ -949,12 +960,19 @@ int TQMenuBar::calculateRects( int max_width ) h = TQMAX( mi->pixmap()->height() + 4, TQApplication::globalStrut().height() ); } else if ( !mi->text().isNull() ) { // text item TQString s = mi->text(); - w = fm.boundingRect( s ).width() - + 2*motifItemHMargin; + if ( gs == GtkStyle ) { + w = fm.boundingRect( s ).width() + 2*gtkItemHMargin; + } else { + w = fm.boundingRect( s ).width() + 2*motifItemHMargin; + } w -= s.tqcontains('&')*fm.width('&'); w += s.tqcontains("&&")*fm.width('&'); w = TQMAX( w, TQApplication::globalStrut().width() ); - h = TQMAX( fm.height() + motifItemVMargin, TQApplication::globalStrut().height() ); + if (gs == GtkStyle ) { + h = TQMAX( fm.height() + gtkItemVMargin, TQApplication::globalStrut().height() ); + } else { + h = TQMAX( fm.height() + motifItemVMargin, TQApplication::globalStrut().height() ); + } } else if ( mi->isSeparator() ) { // separator item if ( tqstyle().tqstyleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) separator = i; //### only motif? |