[Konversation-devel] Fwd: KDE/kdelibs/kdeui/tests

Eike Hein hein at kde.org
Tue Apr 27 15:07:08 CEST 2010



-------- Original Message --------
Subject: KDE/kdelibs/kdeui/tests
Date: Tue, 27 Apr 2010 15:00:38 +0200 (CEST)
From: David Faure <faure at kde.org>
To: kde-commits at kde.org
CC: hein at kde.org

SVN commit 1119595 by dfaure:

Add checkboxes to toggle "autoresize" and "scroll buttons".

The konversation and konqueror use case (autoresize ON, scroll buttons OFF)
leads to too much eliding in many cases, and unused empty space.
This is solved with QTabWidget::setElideMode(Qt::ElideRight), which
also doesn't need all our ktabwidget hacks, but the min size hint is too big
(fixed in http://qt.gitorious.org/qt/qt/merge_requests/583). So IMHO
switching KTabWidget to use QTabWidget::setElideMode is the long-term
solution, once Qt is fixed.

CCMAIL: hein at kde.org


 M  +22 -1     ktabwidgettest.cpp
 M  +2 -0      ktabwidgettest.h


--- trunk/KDE/kdelibs/kdeui/tests/ktabwidgettest.cpp #1119594:1119595
@@ -24,6 +24,7 @@
   mWidget->addTab( new QWidget(), "Four" );
   mWidget->setTabTextColor( 0, Qt::red );
   mWidget->setTabTextColor( 1, Qt::blue );
+  mWidget->setUsesScrollButtons( false ); // corresponding checkbox is
unchecked by default

   connect( mWidget, SIGNAL( currentChanged( QWidget * ) ), SLOT(
currentChanged( QWidget * ) ) );
   connect( mWidget, SIGNAL( contextMenu( QWidget *, const QPoint & )),
SLOT(contextMenu( QWidget *, const QPoint & )));
@@ -86,6 +87,14 @@
   QCheckBox * showlabels = new QCheckBox( "Show labels", grid );
   gridlayout->addWidget( showlabels, 4, 1 );
   connect( showlabels, SIGNAL( toggled(bool) ), this, SLOT(
toggleLabels(bool) ) );
+
+  QCheckBox * elideText = new QCheckBox( "Elide text", grid );
+  gridlayout->addWidget( elideText, 5, 0 );
+  connect( elideText, SIGNAL( toggled(bool) ), this, SLOT(
toggleEliding(bool) ) );
+
+  QCheckBox * scrollButtons = new QCheckBox( "Enable scroll buttons",
grid );
+  gridlayout->addWidget( scrollButtons, 5, 1 );
+  connect( scrollButtons, SIGNAL( toggled(bool) ), this, SLOT(
toggleScrollButtons(bool) ) );
 }

 void Test::currentChanged(QWidget* w)
@@ -95,7 +104,7 @@

 void Test::addTab()
 {
-  mWidget->addTab( new QWidget(), SmallIcon( "konsole" ), QString("Tab
%1").arg( mWidget->count()+1 ) );
+  mWidget->addTab( new QWidget(), SmallIcon( "konsole" ), QString("This
is tab %1").arg( mWidget->count()+1 ) );
 }

 void Test::testCanDecode(const QDragMoveEvent *e, bool &accept /*
result */)
@@ -363,6 +372,18 @@
   mWidget->show();
 }

+void Test::toggleScrollButtons(bool state)
+{
+  mWidget->setUsesScrollButtons(state);
+}
+
+void Test::toggleEliding(bool state)
+{
+  mWidget->setAutomaticResizeTabs(state);
+  //mWidget->setElideMode(state ? Qt::ElideRight : Qt::ElideNone);
+}
+
+
 int main(int argc, char** argv )
 {
     KCmdLineArgs::init(argc, argv, "ktabwidgettest", 0,
ki18n("KTabWidgetTest"), "1.0", ki18n("ktabwidget test app"));
--- trunk/KDE/kdelibs/kdeui/tests/ktabwidgettest.h #1119594:1119595
@@ -29,6 +29,8 @@
   void toggleTabShape(bool);
   void toggleCloseButtons(bool);
   void toggleLabels(bool);
+  void toggleScrollButtons(bool);
+  void toggleEliding(bool);

   void currentChanged(QWidget*);
   void contextMenu(QWidget*, const QPoint&);


More information about the Konversation-devel mailing list