Skip to content

Instantly share code, notes, and snippets.

@mnogu
Created December 27, 2009 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnogu/264274 to your computer and use it in GitHub Desktop.
Save mnogu/264274 to your computer and use it in GitHub Desktop.
Index: qt4/toolbar/common-uimstateindicator.cpp
===================================================================
--- qt4/toolbar/common-uimstateindicator.cpp (revision 6126)
+++ qt4/toolbar/common-uimstateindicator.cpp (working copy)
@@ -129,7 +129,9 @@
return;
QHelperPopupMenu *popupMenu = 0;
+#ifdef PLASMA_APPLET_UIM
int prevCount = m_layout->count();
+#endif
foreach ( QHelperToolbarButton *button, buttons )
{
if ( m_layout->indexOf( button ) >= 0 )
@@ -206,7 +208,9 @@
}
}
+#ifdef PLASMA_APPLET_UIM
if ( m_layout->count() != prevCount )
+#endif
emit indicatorResized();
parentWidget()->show();
Index: qt4/toolbar/standalone-qt4.cpp
===================================================================
--- qt4/toolbar/standalone-qt4.cpp (revision 6126)
+++ qt4/toolbar/standalone-qt4.cpp (working copy)
@@ -62,11 +62,11 @@
setLayout( layout );
adjustSize();
- UimToolbarDraggingHandler *h = new UimToolbarDraggingHandler( this );
- layout->addWidget( h );
- h->adjustSize();
- h->show();
- connect( h, SIGNAL( handleDoubleClicked() ),
+ handler = new UimToolbarDraggingHandler( this );
+ layout->addWidget( handler );
+ handler->adjustSize();
+ handler->show();
+ connect( handler, SIGNAL( handleDoubleClicked() ),
this, SLOT( slotToolbarDoubleClicked() ) );
@@ -81,11 +81,12 @@
int panelHeight = 64; // FIXME!
int screenwidth = QApplication::desktop()->screenGeometry().width();
int screenheight = QApplication::desktop()->screenGeometry().height();
- QPoint p( screenwidth - panelHeight - toolbar->width() - h->width(), screenheight - height() - panelHeight );
+ QPoint p( screenwidth - panelHeight - toolbar->width()
+ - handler->width(), screenheight - height() - panelHeight );
move( p );
// Enable Dragging Feature
- connect( h, SIGNAL( moveTo( const QPoint & ) ),
+ connect( handler, SIGNAL( moveTo( const QPoint & ) ),
this, SLOT( moveTo( const QPoint & ) ) );
// Quit
@@ -102,16 +103,20 @@
void
UimStandaloneToolbar::slotToolbarResized()
{
+ toolbar->show();
adjustSize();
}
void
UimStandaloneToolbar::slotToolbarDoubleClicked()
{
- if (toolbar->isVisible())
- toolbar->hide();
- else
- toolbar->show();
+ if (toolbar->isVisible()) {
+ toolbar->hide();
+ setFixedWidth(handler->width());
+ setMaximumWidth(QWIDGETSIZE_MAX);
+ } else {
+ toolbar->show();
+ }
adjustSize();
}
Index: qt4/toolbar/standalone-qt4.h
===================================================================
--- qt4/toolbar/standalone-qt4.h (revision 6126)
+++ qt4/toolbar/standalone-qt4.h (working copy)
@@ -37,6 +37,7 @@
#include <QtGui/QMouseEvent>
class QUimHelperToolbar;
+class UimToolbarDraggingHandler;
class QPoint;
class QMouseEvent;
@@ -57,6 +58,7 @@
void moveTo(const QPoint &point);
private:
+ UimToolbarDraggingHandler *handler;
QUimHelperToolbar *toolbar;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment