From 654de5cbfe2775c53518f10025880c8445732853 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 22 Dec 2005 14:57:55 +0000 Subject: [PATCH] IPAL10673: Mark active viewer better IPAL10398: Wrong popup for tabulated viewers --- src/Qtx/QtxWorkstack.cxx | 42 ++++++++++++++++++++++++++++++++++------ src/Qtx/QtxWorkstack.h | 1 + 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 854b7f8a0..c267236f2 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -35,7 +35,9 @@ #include #include #include +#include +#define DARK_COLOR_LIGHT 250 /*! Class: QtxWorkstack [Public] Descr: @@ -45,7 +47,8 @@ QtxWorkstack::QtxWorkstack( QWidget* parent ) : QWidget( parent ), myWin( 0 ), myArea( 0 ), -myWorkWin( 0 ) +myWorkWin( 0 ), +myWorkArea( 0 ) { myActionsMap.insert( SplitVertical, new QAction( tr( "Split vertically" ), 0, this ) ); myActionsMap.insert( SplitHorizontal, new QAction( tr( "Split horizontally" ), 0, this ) ); @@ -95,7 +98,9 @@ QWidget* QtxWorkstack::activeWindow() const void QtxWorkstack::split( const int o ) { - QtxWorkstackArea* area = activeArea(); + QtxWorkstackArea* area = myWorkArea; + if ( !area ) + area = activeArea(); if ( !area ) return; @@ -861,14 +866,19 @@ void QtxWorkstack::onDeactivated( QtxWorkstackArea* area ) void QtxWorkstack::onContextMenuRequested( QWidget* w, QPoint p ) { - if ( !activeArea() ) + QtxWorkstackArea* anArea = dynamic_cast( (QObject*)sender() ); + if ( !anArea ) + anArea = activeArea(); + + if ( !anArea ) return; - QWidgetList lst = activeArea()->widgetList(); + QWidgetList lst = anArea->widgetList(); if ( lst.isEmpty() ) return; myWorkWin = w; + myWorkArea = anArea; QPopupMenu* pm = new QPopupMenu(); @@ -891,6 +901,7 @@ void QtxWorkstack::onContextMenuRequested( QWidget* w, QPoint p ) delete pm; myWorkWin = 0; + myWorkArea = 0; } void QtxWorkstack::childEvent( QChildEvent* e ) @@ -1203,6 +1214,7 @@ void QtxWorkstackArea::insertWidget( QWidget* wid, const int idx ) updateState(); setWidgetActive( wid ); + wid->setFocus(); } void QtxWorkstackArea::onContextMenuRequested( QPoint p ) @@ -1388,8 +1400,14 @@ void QtxWorkstackArea::customEvent( QCustomEvent* e ) { if ( !activeWidget()->focusWidget() ) activeWidget()->setFocus(); - else - activeWidget()->focusWidget()->setFocus(); + else { + if ( activeWidget()->focusWidget()->hasFocus()) { + QFocusEvent in(QEvent::FocusIn); + QApplication::sendEvent(this, &in); + } + else + activeWidget()->focusWidget()->setFocus(); + } } break; case RemoveWidget: @@ -1775,6 +1793,18 @@ void QtxWorkstackTabBar::setActive( const bool on ) { QFont aFont = font(); aFont.setUnderline( on ); + QColorGroup* aColGrp = new QColorGroup(); + QPalette aPal = palette(); + if ( !on ) { + aPal.setColor( QColorGroup::HighlightedText, aColGrp->foreground() ); + aPal.setColor( QColorGroup::Highlight, colorGroup().dark().light( DARK_COLOR_LIGHT ) ); + setPalette( aPal ); + } + else { + aPal.setColor( QColorGroup::HighlightedText, aColGrp->highlightedText() ); + aPal.setColor( QColorGroup::Highlight, aColGrp->highlight() ); + unsetPalette(); + } setFont( aFont ); update(); diff --git a/src/Qtx/QtxWorkstack.h b/src/Qtx/QtxWorkstack.h index ea01c19a3..8157a2a81 100644 --- a/src/Qtx/QtxWorkstack.h +++ b/src/Qtx/QtxWorkstack.h @@ -131,6 +131,7 @@ private: QtxWorkstackArea* myArea; QSplitter* mySplit; QWidget* myWorkWin; + QtxWorkstackArea* myWorkArea; QMap myActionsMap; //!< The map of the actions. Allows to get the QAction object by the key. -- 2.39.2