[yast-commit] r42580 - in /branches/tmp/coolo/qt4-port/src: YQMultiSelectionBox.cc YQTree.cc YQTree.h
Author: dmacvicar Date: Mon Dec 3 00:37:20 2007 New Revision: 42580 URL: http://svn.opensuse.org/viewcvs/yast?rev=42580&view=rev Log: compiles, YQMultiSelectionBoxItem looks like it should, same as YQTree Modified: branches/tmp/coolo/qt4-port/src/YQMultiSelectionBox.cc branches/tmp/coolo/qt4-port/src/YQTree.cc branches/tmp/coolo/qt4-port/src/YQTree.h Modified: branches/tmp/coolo/qt4-port/src/YQMultiSelectionBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQMultiSelectionBox.cc?rev=42580&r1=42579&r2=42580&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQMultiSelectionBox.cc (original) +++ branches/tmp/coolo/qt4-port/src/YQMultiSelectionBox.cc Mon Dec 3 00:37:20 2007 @@ -19,10 +19,10 @@ //#define QT3_SUPPORT 1 #include <limits.h> -#include <qstring.h> -#include <qlabel.h> +#include <QString> +#include <QLabel> #include <QVBoxLayout> -#include <q3header.h> +#include <QHeaderView> #define y2log_component "qt-ui" #include <ycp/y2log.h> @@ -64,7 +64,8 @@ _qt_listView->setHeaderLabel(""); // QListView doesn't have one single column by default! _qt_listView->sortItems( 0, Qt::AscendingOrder ); //FIXME _qt_listView->header()->setStretchEnabled( true ); - //_qt_listView->header()->hide(); + _qt_listView->header()->hide(); + _qt_listView->setRootIsDecorated ( false ); _caption->setBuddy( _qt_listView ); // Very small default size if specified @@ -332,6 +333,8 @@ , _multiSelectionBox( parent ) { YUI_CHECK_PTR( yItem ); + setFlags( Qt::ItemIsUserCheckable ); + setCheckState( 0, Qt::Unchecked ); setText(0, fromUTF8( yItem->label() )); setFlags(Qt::ItemIsUserCheckable); _serial = _item_count++; Modified: branches/tmp/coolo/qt4-port/src/YQTree.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQTree.cc?rev=42580&r1=42579&r2=42580&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQTree.cc (original) +++ branches/tmp/coolo/qt4-port/src/YQTree.cc Mon Dec 3 00:37:20 2007 @@ -16,16 +16,15 @@ /-*/ -#define QT3_SUPPORT +//#define QT3_SUPPORT #include <QColorGroup> -#include <q3header.h> -#include <qlabel.h> -#include <q3vbox.h> -#include <q3listview.h> +#include <QHeaderView> +#include <QLabel> +#include <QTreeWidget> #include <QVBoxLayout> -#include <qstring.h> +#include <QString> //Added by qt3to4: -#include <qpixmap.h> +#include <QPixmap> #define y2log_component "qt-ui" #include <ycp/y2log.h> @@ -61,24 +60,26 @@ YUI_CHECK_NEW( _caption ); layout->addWidget( _caption ); - _qt_listView = new Q3ListView( this ); + _qt_listView = new QTreeWidget( this ); YUI_CHECK_NEW( _qt_listView ); layout->addWidget( _qt_listView ); - _qt_listView->addColumn( "" ); - _qt_listView->header()->hide(); - _qt_listView->setRootIsDecorated ( true ); + //_qt_listView->setHeaderLabel(""); +// _qt_listView->addColumn( "" ); + _qt_listView->header()->hide(); + // _qt_listView->setHeader(0L); + _qt_listView->setRootIsDecorated ( true ); _caption->setBuddy ( _qt_listView ); - connect( _qt_listView, SIGNAL( selectionChanged ( Q3ListViewItem * ) ), - this, SLOT ( slotSelected ( Q3ListViewItem * ) ) ); + connect( _qt_listView, SIGNAL( selectionChanged ( QTreeWidgetItem * ) ), + this, SLOT ( slotSelected ( QTreeWidgetItem * ) ) ); - connect( _qt_listView, SIGNAL( spacePressed ( Q3ListViewItem * ) ), - this, SLOT ( slotActivated ( Q3ListViewItem * ) ) ); + connect( _qt_listView, SIGNAL( spacePressed ( QTreeWidgetItem * ) ), + this, SLOT ( slotActivated ( QTreeWidgetItem * ) ) ); - connect( _qt_listView, SIGNAL( doubleClicked ( Q3ListViewItem * ) ), - this, SLOT ( slotActivated ( Q3ListViewItem * ) ) ); + connect( _qt_listView, SIGNAL( doubleClicked ( QTreeWidgetItem * ) ), + this, SLOT ( slotActivated ( QTreeWidgetItem * ) ) ); } @@ -138,13 +139,13 @@ YQTreeItem * yqTreeItem = (YQTreeItem *) treeItem->data(); YUI_CHECK_PTR( yqTreeItem ); - if ( ! selected && yqTreeItem == _qt_listView->selectedItem() ) + if ( ! selected && yqTreeItem == _qt_listView->currentItem() ) { deselectAllItems(); } else { - _qt_listView->setSelected( yqTreeItem, true ); + yqTreeItem->setSelected( true ); openBranch( yqTreeItem ); YTree::selectItem( treeItem, selected ); } @@ -157,7 +158,7 @@ { YQSignalBlocker sigBlocker( _qt_listView ); - _qt_listView->setSelected( item, true ); + item->setSelected( true ); openBranch( item ); YTree::selectItem( item->origItem(), true ); @@ -166,12 +167,12 @@ } -void YQTree::openBranch( Q3ListViewItem * item ) +void YQTree::openBranch( QTreeWidgetItem * item ) { while ( item ) { - item->setOpen( true ); // Takes care of origItem()->setOpen() - item = item->parent(); + item->setExpanded( true ); // Takes care of origItem()->setOpen() + item = item->parent(); } } @@ -194,7 +195,7 @@ } -void YQTree::slotSelected( Q3ListViewItem * qItem ) +void YQTree::slotSelected( QTreeWidgetItem * qItem ) { selectItem( dynamic_cast<YQTreeItem *> (qItem) ); @@ -203,7 +204,7 @@ } -void YQTree::slotActivated( Q3ListViewItem * qItem ) +void YQTree::slotActivated( QTreeWidgetItem * qItem ) { selectItem( dynamic_cast<YQTreeItem *> (qItem) ); @@ -257,10 +258,10 @@ YQTreeItem::YQTreeItem( YQTree * tree, - Q3ListView * listView, + QTreeWidget * listView, YTreeItem * orig, int serial ) - : Q3ListViewItem( listView ) + : QTreeWidgetItem( listView ) { init( tree, orig, serial ); @@ -274,10 +275,9 @@ YQTreeItem * parentItem, YTreeItem * orig, int serial ) - : Q3ListViewItem( parentItem ) + : QTreeWidgetItem( parentItem ) { init( tree, orig, serial ); - #if VERBOSE_TREE_ITEMS y2debug( "Creating tree item \"%s\" as child of \"%s\"", orig->label().c_str(), @@ -310,7 +310,7 @@ if ( icon.isNull() ) y2warning( "Can't load icon %s", iconName.c_str() ); else - setPixmap( 0, icon ); + setData( 0, Qt::DecorationRole, icon ); } } @@ -318,7 +318,7 @@ void YQTreeItem::setOpen( bool open ) { - Q3ListViewItem::setOpen( open ); + QTreeWidgetItem::setExpanded( open ); _origItem->setOpen( open ); } Modified: branches/tmp/coolo/qt4-port/src/YQTree.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQTree.h?rev=42580&r1=42579&r2=42580&view=diff ============================================================================== --- branches/tmp/coolo/qt4-port/src/YQTree.h (original) +++ branches/tmp/coolo/qt4-port/src/YQTree.h Mon Dec 3 00:37:20 2007 @@ -21,7 +21,7 @@ #define YQTree_h #include <QFrame> -#include <qlistview.h> +#include <QTreeWidget> #include "YTree.h" @@ -125,14 +125,14 @@ * * This will trigger a 'SelectionChanged' event if 'notify' is set. **/ - void slotSelected( Q3ListViewItem * item ); + void slotSelected( QTreeWidgetItem * item ); /** * Propagate a double click or pressing the space key on a tree item. * * This will trigger an 'Activated' event if 'notify' is set. **/ - void slotActivated( Q3ListViewItem * item); + void slotActivated( QTreeWidgetItem * item); protected: @@ -145,7 +145,7 @@ /** * Open the branch of 'item' recursively to its toplevel item. **/ - void openBranch( Q3ListViewItem * item ); + void openBranch( QTreeWidgetItem * item ); /** * Build a tree of items that will be displayed (YQTreeItems) from the @@ -161,12 +161,12 @@ // YQWidgetCaption * _caption; - Q3ListView * _qt_listView; + QTreeWidget * _qt_listView; int _nextSerialNo; }; -class YQTreeItem: public Q3ListViewItem +class YQTreeItem: public QTreeWidgetItem { public: @@ -174,7 +174,7 @@ * Constructor for a top level item. **/ YQTreeItem( YQTree * tree, - Q3ListView * parent, + QTreeWidget * parent, YTreeItem * origItem, int serial ); @@ -194,7 +194,7 @@ /** * Open this item. * - * Reimplemented from Q3ListViewItem. + * Reimplemented from QTreeWidgetItem. **/ virtual void setOpen( bool open ); @@ -214,7 +214,7 @@ /** * Sort key of this item. * - * Reimplemented from Q3ListViewItem. + * Reimplemented from QTreeWidgetItem. **/ QString key( int column, bool ascending ) const; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
dmacvicar@svn.opensuse.org