[Kde-print-devel] [Bug 139882] JJ: "Driver Settings" tab: lower pane can only show 3 lines, has fixed height, should be resizeable (better usability)

Aaron J.Seigo aseigo at kde.org
Thu Jan 11 06:56:17 CET 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=139882         
aseigo kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From aseigo kde org  2007-01-11 06:56 -------
SVN commit 622237 by aseigo:

use a splitter
hide the header
don't show the radio button selector (crash on click)
get rid of the ugly groupbox (use a bold label instead)
get rid of the gratuitous subclass of QTreeWidget

holy crap batman! 15 minutes of fiddling around and it looks one par with the one in kde3, only with BR#139882 addressed!

CCMAIL:kpfeifle danka de
BUG:139882


 M  +4 -1      driver.cpp  
 M  +20 -14    driverview.cpp  
 M  +3 -8      driverview.h  
 M  +20 -12    droptionview.cpp  
 M  +3 -2      droptionview.h  


--- trunk/KDE/kdelibs/kdeprint/driver.cpp #622236:622237
 @ -116,6 +116,7  @
 DriverItem* DrMain::createTreeView(QTreeWidget *parent)
 {
 	DriverItem	*root = new DriverItem(parent, this);
+	root->setExpanded(true);
 	createTree(root);
 	return root;
 }
 @ -250,8 +251,10  @
 {
 	DriverItem	*item(0);
 
-	foreach (DrGroup* subgroup, m_subgroups)
+	foreach (DrGroup* subgroup, m_subgroups) {
 		item = subgroup->createItem(parent, item);
+		item->setExpanded(true);
+	}
 
 	foreach (DrBase* option, m_listoptions)
 		item = option->createItem(parent, item);
--- trunk/KDE/kdelibs/kdeprint/driverview.cpp #622236:622237
 @ -22,16 +22,14  @
 #include "driveritem.h"
 #include "driver.h"
 
+#include <QHeaderView>
 #include <QLayout>
+#include <QSplitter>
+#include <QTreeWidget>
 
+#include <kdialog.h>
 #include <klocale.h>
 
-DrListView::DrListView( QWidget *parent )
-    : QTreeWidget(parent)
-{
-	setFrameStyle(QFrame::WinPanel|QFrame::Sunken);
-}
-
 //****************************************************************************************************
 
 DriverView::DriverView( QWidget *parent )
 @ -88,19 +86,27  @
 
 	m_driver = 0;
 
-	m_view = new DrListView(this);
-	  m_view->setWhatsThis(whatsThisPPDOptionsDriverPage);
-	m_optview = new DrOptionView(this);
-	  m_optview->setWhatsThis(whatsThisOptionSettingsDriverPage);
+	QSplitter* splitter = new QSplitter(Qt::Vertical, this);
 
+	m_view = new QTreeWidget(splitter);
+	m_view->header()->hide();
+	m_view->setWhatsThis(whatsThisPPDOptionsDriverPage);
+	splitter->addWidget(m_view);
+
+	m_optview = new DrOptionView(splitter);
+	m_optview->setWhatsThis(whatsThisOptionSettingsDriverPage);
+	splitter->addWidget(m_optview);
+
+	// make sure the top gets enough room
+	splitter->setStretchFactor(0, 10);
+
 	QVBoxLayout	*main_ = new QVBoxLayout(this);
 	main_->setMargin(0);
-	main_->setSpacing(10);
-	main_->addWidget(m_view,1);
-	main_->addWidget(m_optview,0);
+	main_->setSpacing(KDialog::spacingHint());
+	main_->addWidget(splitter);
 
 	connect(m_view,SIGNAL(itemSelectionChanged()), this, SLOT( slotItemSelectionChanged() ) );
-  connect(this,SIGNAL(itemSelected(QTreeWidgetItem*)), m_optview,SLOT(slotItemSelected(QTreeWidgetItem*)));
+	connect(this,SIGNAL(itemSelected(QTreeWidgetItem*)), m_optview,SLOT(slotItemSelected(QTreeWidgetItem*)));
 	connect(m_optview,SIGNAL(changed()),SLOT(slotChanged()));
 }
 
--- trunk/KDE/kdelibs/kdeprint/driverview.h #622236:622237
 @ -22,20 +22,15  @
 #define DRIVERVIEW_H
 
 #include <QMap>
-#include <QTreeWidget>
 #include <QWidget>
 
 #include <kdelibs_export.h>
 
+class QTreeWidget;
+class QTreeWidgetItem;
 class DrOptionView;
 class DrMain;
 
-class KDEPRINT_EXPORT DrListView : public QTreeWidget
-{
-public:
-	DrListView(QWidget *parent = 0);
-};
-
 class KDEPRINT_EXPORT DriverView : public QWidget
 {
 	Q_OBJECT
 @ -57,7 +52,7  @
 	void slotItemSelectionChanged();
 
 private:
-	DrListView	*m_view;
+	QTreeWidget	*m_view;
 	DrOptionView	*m_optview;
 	DrMain		*m_driver;
 	int 		m_conflict;
--- trunk/KDE/kdelibs/kdeprint/droptionview.cpp #622236:622237
 @ -295,9 +295,20  @
 //******************************************************************************************************
 
 DrOptionView::DrOptionView(QWidget *parent)
-	: QGroupBox(parent)
+	: QWidget(parent)
 {
+	QVBoxLayout* layout = new QVBoxLayout(this);
+	layout->setSpacing(KDialog::spacingHint());
+	layout->setMargin(0);
+
+	m_title = new QLabel(this);
+	layout->addWidget(m_title);
+	setTitle(i18n("No Option Selected"));
+
 	m_stack = new QStackedWidget(this);
+	layout->addWidget(m_stack);
+	layout->setStretchFactor(m_stack, 10);
+	layout->addStretch(1);
 
 	OptionBaseView	*w = new OptionBaseView(m_stack);
 	connect(w,SIGNAL(valueChanged(const QString&)),SLOT(slotValueChanged(const QString&)));
 @ -319,18 +330,8  @
 	connect(w,SIGNAL(valueChanged(const QString&)),SLOT(slotValueChanged(const QString&)));
 	m_optionBaseID[ m_stack->addWidget(w) ] = DrBase::Boolean;
 
-	m_stack->setCurrentWidget(w);
-	setTitle(i18n("No Option Selected"));
+	m_stack->setCurrentIndex(0);
 
-	setLayout( new QVBoxLayout );
-	layout()->setSpacing( KDialog::spacingHint() );
-	layout()->setMargin( KDialog::marginHint() );
-	QVBoxLayout	*main_ = new QVBoxLayout();
-	main_->setMargin(0);
-	main_->setSpacing(0);
-	main_->addWidget(m_stack);
-	layout()->addItem(main_);
-
 	m_item = 0;
 	m_block = false;
 	m_allowfixed = true;
 @ -360,13 +361,20  @
 			enabled = ((m_item->drItem()->get("fixed") != "1") || m_allowfixed);
 		}
 		else
+		{
 			setTitle(i18n("No Option Selected"));
+		}
 		m_stack->setCurrentWidget(w);
 		w->setEnabled(enabled);
 		m_block = false;
 	}
 }
 
+void DrOptionView::setTitle(const QString& title)
+{
+	m_title->setText("<b>" + title + "<b>");
+}
+
 OptionBaseView *DrOptionView::optionBaseView( int id )
 {
 	for ( int i = 0; i < 5; ++i )
--- trunk/KDE/kdelibs/kdeprint/droptionview.h #622236:622237
 @ -21,7 +21,6  @
 #define DROPTIONVIEW_H
 
 #include <qwidget.h>
-#include <QGroupBox>
 #include <qstringlist.h>
 
 class QLineEdit;
 @ -114,7 +113,7  @
 	QStringList	m_choices;
 };
 
-class DrOptionView : public QGroupBox
+class DrOptionView : public QWidget
 {
 	Q_OBJECT
 public:
 @ -130,8 +129,10  @
 
 private:
 	OptionBaseView *optionBaseView( int id );
+	void setTitle(const QString& title);
 	
 	int m_optionBaseID[5];
+	QLabel		* m_title;
 	QStackedWidget	*m_stack;
 	DriverItem	*m_item;
 	bool		m_block;


More information about the Kde-print-devel mailing list