summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-12-05 12:12:10 (UTC)
committer zautrix <zautrix>2004-12-05 12:12:10 (UTC)
commit5ab47964d8b52897bb0662ef4a5fcf9604acaf6c (patch) (side-by-side diff)
tree0f80433206ddd6b4ef901cb346d0f06caf76b20f /microkde
parent196365e533c6fd1a8f47aa9579763ef5afcebcda (diff)
downloadkdepimpi-5ab47964d8b52897bb0662ef4a5fcf9604acaf6c.zip
kdepimpi-5ab47964d8b52897bb0662ef4a5fcf9604acaf6c.tar.gz
kdepimpi-5ab47964d8b52897bb0662ef4a5fcf9604acaf6c.tar.bz2
fixed kapi toolbar repaint problem
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/ktoolbar.cpp6
-rw-r--r--microkde/kdeui/ktoolbar.h3
2 files changed, 8 insertions, 1 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 79b0f9d..e9226c0 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -1365,96 +1365,102 @@ void KToolBar::childEvent( QChildEvent *e )
::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
// prevent items that have been explicitly inserted by insert*() from
// being inserted again
if ( !widget2id.contains( w ) )
{
int dummy = -1;
insertWidgetInternal( w, dummy, -1 );
}
}
} else {
removeWidgetInternal( w );
}
if ( isVisibleTo( 0 ) )
{
QBoxLayout *l = boxLayout();
// QLayout *l = layout();
// clear the old layout so that we don't get unnecassery layout
// changes till we have rebuild the thing
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
layoutTimer->start( 50, TRUE );
}
}
QToolBar::childEvent( e );
}
void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
{
// we can't have it in widgets, or something is really wrong
//widgets.removeRef( w );
connect( w, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ) );
if ( index == -1 || index > (int)widgets.count() ) {
widgets.append( w );
index = (int)widgets.count();
}
else
widgets.insert( index, w );
if ( id == -1 )
id = id2widget.count();
id2widget.insert( id, w );
widget2id.insert( w, id );
}
+void KToolBar::repaintMe()
+{
+ setUpdatesEnabled( true );
+ QToolBar::repaint( true );
+ qDebug(" KToolBar::repaintMe() ");
+}
void KToolBar::showEvent( QShowEvent *e )
{
QToolBar::showEvent( e );
rebuildLayout();
}
void KToolBar::setStretchableWidget( QWidget *w )
{
QToolBar::setStretchableWidget( w );
stretchableWidget = w;
}
QSizePolicy KToolBar::sizePolicy() const
{
if ( orientation() == Horizontal )
return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
else
return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
}
QSize KToolBar::sizeHint() const
{
return QToolBar::sizeHint();
#if 0
QWidget::polish();
static int iii = 0;
++iii;
qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
switch( barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
for ( QWidget *w = widgets.first(); w; w =widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(6, 0);
}
else
{
QSize sh = w->sizeHint();
if (!sh.isValid())
sh = w->minimumSize();
minSize = minSize.expandedTo(QSize(0, sh.height()));
minSize += QSize(sh.width()+1, 0);
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 2c061b5..61b5ea3 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -1000,108 +1000,109 @@ signals:
* The parameter @p isHighlighted is @p true when mouse enters and @p false when
* mouse exits.
*/
void highlighted(int id, bool isHighlighted);
/**
* This signal is emitted when item id gets highlighted/unhighlighted
* (i.e when mouse enters/exits).
*
* Note that this signal is emitted from
* all buttons (normal, disabled and toggle) even when there is no visible
* change in buttons (i.e., buttons do not raise when mouse enters).
*/
void highlighted(int id );
/**
* Emitted when toolbar changes position, or when
* an item is removed from toolbar.
*
* If you subclass @ref KMainWindow and reimplement
* @ref KMainWindow::resizeEvent() be sure to connect to
* this signal. Note: You can connect this signal to a slot that
* doesn't take parameter.
*/
void moved( BarPosition );
/**
* @internal
* This signal is emitted when toolbar detects changing of
* following parameters:
* highlighting, button-size, button-mode. This signal is
* internal, aimed to buttons.
*/
void modechange ();
/**
* This signal is emitted when the toolbar is getting deleted,
* and before ~KToolbar finishes (so it's still time to remove
* widgets from the toolbar).
* Used by KWidgetAction.
* @since 3.2
*/
void toolbarDestroyed();
public:
/**
* @return global setting for "Highlight buttons under mouse"
*/
+ void repaintMe();
static bool highlightSetting();
/**
* @return global setting for "Toolbars transparent when moving"
*/
static bool transparentSetting();
/**
* @return global setting for "Icon Text"
*/
static IconText iconTextSetting();
public slots:
virtual void setIconText( const QString &txt )
{ QToolBar::setIconText( txt ); }
+ void slotRepaint();
protected:
void mousePressEvent( QMouseEvent * );
void childEvent( QChildEvent *e );
void showEvent( QShowEvent *e );
void resizeEvent( QResizeEvent *e );
bool event( QEvent *e );
void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false);
QString settingsGroup();
private slots:
void rebuildLayout();
void slotReadConfig ();
void slotAppearanceChanged();
void slotIconChanged(int);
- void slotRepaint();
void toolBarPosChanged( QToolBar *tb );
void slotContextAboutToShow();
void widgetDestroyed();
private:
void init( bool readConfig = true, bool honorStyle = false );
void doConnections( KToolBarButton *button );
void insertWidgetInternal( QWidget *w, int &index, int id );
void removeWidgetInternal( QWidget *w );
void getAttributes( QString &position, QString &icontext, int &index );
//US KPopupMenu *contextMenu();
QPopupMenu *contextMenu();
QMap<QWidget*, int > widget2id;
typedef QMap<int, QWidget* > Id2WidgetMap;
Id2WidgetMap id2widget;
//US KPopupMenu *context;
QPopupMenu *context;
QPtrList<QWidget> widgets;
QTimer *layoutTimer;
QGuardedPtr<QWidget> stretchableWidget, rightAligned;
protected:
virtual void virtual_hook( int id, void* data );
private:
KToolBarPrivate *d;
bool inshutdownprocess;
};
#endif