Revision: 6574
Author: nogu.dev
Date: Fri Jul 23 18:58:16 2010
Log: * qt4/toolbar/standalone-qt4.h
- (UimStandaloneToolbar::slotToolbarDoubleClicked): Adjust size.
- (UimToolbarDraggingHandler::sizeHint): Remove.
- (UimToolbarDraggingHandler::drawContents): Remove.
QFrame::drawContents() doesn't exist.
- (UimToolbarDraggingHandler::paintEvent):
Draw line as uim-toolbar-qt does.
* qt4/toolbar/standalone-qt4.cpp
- (UimToolbarDraggingHandler)
* Remove drawContents().
* Remove sizeHint()
* Add paintEvent().
http://code.google.com/p/uim/source/detail?r=6574
Modified:
/trunk/qt4/toolbar/standalone-qt4.cpp
/trunk/qt4/toolbar/standalone-qt4.h
=======================================
--- /trunk/qt4/toolbar/standalone-qt4.cpp Sat May 8 02:13:21 2010
+++ /trunk/qt4/toolbar/standalone-qt4.cpp Fri Jul 23 18:58:16 2010
@@ -42,8 +42,7 @@
#include <QtGui/QDesktopWidget>
#include <QtGui/QHBoxLayout>
#include <QtGui/QMouseEvent>
-#include <QtGui/QStyle>
-#include <QtGui/QStyleOption>
+#include <QtGui/QPainter>
#include <clocale>
@@ -112,14 +111,12 @@
{
if (toolbar->isVisible()) {
toolbar->hide();
- // shrink this toolbar
- int width = maximumWidth();
setFixedWidth(handler->width());
- setMaximumWidth(width);
} else {
toolbar->show();
- }
- adjustSize();
+ toolbar->adjustSize();
+ setFixedWidth(handler->width() + toolbar->width());
+ }
}
void
@@ -137,26 +134,6 @@
setFixedWidth( 10 );
}
-
-void UimToolbarDraggingHandler::drawContents( QPainter* p )
-{
- const QStyle::State flags = QStyle::State_None |
QStyle::State_Horizontal;
- QStyleOption opt;
- opt.state = flags;
- style()->drawPrimitive( QStyle::PE_IndicatorToolBarSeparator,
- &opt, p, this );
-}
-
-QSize UimToolbarDraggingHandler::sizeHint() const
-{
- int width, height;
-
- width = style()->pixelMetric( QStyle::PM_DockWidgetSeparatorExtent,
- 0, this );
- height = BUTTON_SIZE + TOOLBAR_MARGIN_SIZE * 2;
-
- return QSize( width, height );
-}
QSizePolicy UimToolbarDraggingHandler::sizePolicy() const
{
@@ -196,6 +173,17 @@
isDragging = false;
emit handleDoubleClicked();
}
+
+void UimToolbarDraggingHandler::paintEvent( QPaintEvent *e )
+{
+ QFrame::paintEvent( e );
+
+ QPainter painter( this );
+ int w = width();
+ int h = height();
+ qDrawShadeLine( &painter, w / 2, TOOLBAR_MARGIN_SIZE,
+ w / 2, h - TOOLBAR_MARGIN_SIZE, palette() );
+}
int main( int argc, char *argv[] )
{
=======================================
--- /trunk/qt4/toolbar/standalone-qt4.h Sun Apr 4 20:35:54 2010
+++ /trunk/qt4/toolbar/standalone-qt4.h Fri Jul 23 18:58:16 2010
@@ -69,7 +69,6 @@
public:
explicit UimToolbarDraggingHandler( QWidget *parent );
- QSize sizeHint() const;
QSizePolicy sizePolicy() const;
signals:
@@ -77,12 +76,11 @@
void handleDoubleClicked();
protected:
- void drawContents( QPainter* );
-
void mousePressEvent ( QMouseEvent * e );
void mouseReleaseEvent ( QMouseEvent * e );
void mouseMoveEvent ( QMouseEvent * e );
void mouseDoubleClickEvent ( QMouseEvent * e );
+ void paintEvent ( QPaintEvent * e );
private:
bool isDragging;