Author: coolo
Date: Thu Jan 10 12:28:06 2008
New Revision: 43518
URL: http://svn.opensuse.org/viewcvs/yast?rev=43518&view=rev
Log:
I did not manage to find a way to hide the header without
hiding the icons too, so show a header too
Modified:
trunk/qt/src/QY2ListView.cc
trunk/qt/src/QY2ListView.h
trunk/qt/src/pkg/YQPatternSelector.cc
trunk/qt/src/pkg/YQPkgDiskUsageList.cc
trunk/qt/src/pkg/YQPkgObjList.cc
trunk/qt/src/pkg/YQPkgPatchList.cc
trunk/qt/src/pkg/YQPkgPatternList.cc
Modified: trunk/qt/src/QY2ListView.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/QY2ListView.cc?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/QY2ListView.cc (original)
+++ trunk/qt/src/QY2ListView.cc Thu Jan 10 12:28:06 2008
@@ -333,10 +333,24 @@
}
+#if 0
+class QY2ListViewItemDelegate : public QItemDelegate
+{
+public:
+ QY2ListViewItemDelegate( QTreeWidget *parent ) : QItemDelegate( parent ) {}
+ virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
+ {
+ painter->save();
-
-
+ QY2ListViewItem *item = dynamic_cast(_view->itemFromIndex(index));
+ if ( item )
+ {
+ }
+ painter->restore();
+ }
+};
+#endif
QY2ListViewItem::QY2ListViewItem( QY2ListView * parentListView,
const QString & text )
@@ -396,22 +410,6 @@
return QTreeWidgetItem::operator<(otherListViewItem);
}
-// void
-// QY2ListViewItem::paintCell( QPainter * painter,
-// const QColorGroup & colorGroup,
-// int column,
-// int width,
-// int alignment )
-// {
-// QColorGroup cg = colorGroup;
-//
-// if ( _textColor.isValid() ) cg.setColor( QColorGroup::Text, _textColor );
-// if ( _backgroundColor.isValid() ) cg.setColor( QColorGroup::Base, _backgroundColor );
-//
-// QTreeWidgetItem::paintCell( painter, cg, column, width, alignment );
-// }
-
-
QY2CheckListItem::QY2CheckListItem( QY2ListView * parentListView,
const QString & text )
: QY2ListViewItem( parentListView, text)
Modified: trunk/qt/src/QY2ListView.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/QY2ListView.h?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/QY2ListView.h (original)
+++ trunk/qt/src/QY2ListView.h Thu Jan 10 12:28:06 2008
@@ -263,20 +263,6 @@
int serial() const { return _serial; }
/**
- * Set the text foreground color for all columns.
- * For more specific purposes reimiplement paintCell().
- **/
- void setTextColor( const QColor & col )
- { _textColor = col; }
-
- /**
- * Set the text background color for all columns.
- * For more specific purposes reimiplement paintCell().
- **/
- void setBackgroundColor( const QColor & col )
- { _backgroundColor = col; }
-
- /**
* Returns a tool tip text for a specific column of this item.
* 'column' is -1 if the mouse pointer is in the tree indentation area.
*
@@ -384,26 +370,11 @@
protected:
- /**
- * Paint method. Reimplemented from @ref QTreeWidgetItem so different
- * colors can be used.
- *
- * Reimplemented from QTreeWidgetItem.
- **/
- /*virtual void paintCell( QPainter * painter,
- const QColorGroup & colorGroup,
- int column,
- int width,
- int alignment );
- */
//
// Data members
//
int _serial;
-
- QColor _textColor;
- QColor _backgroundColor;
};
Modified: trunk/qt/src/pkg/YQPatternSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPatternSelector.cc?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPatternSelector.cc (original)
+++ trunk/qt/src/pkg/YQPatternSelector.cc Thu Jan 10 12:28:06 2008
@@ -148,7 +148,7 @@
false ); // no autoFilter - filterMatch() is not connected
Q_CHECK_PTR( _patternList );
layout->addWidget(_patternList);
- _patternList->header()->hide();
+ //_patternList->header()->hide();
}
if ( ! _patternList )
Modified: trunk/qt/src/pkg/YQPkgDiskUsageList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgDiskUsageList.cc?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgDiskUsageList.cc (original)
+++ trunk/qt/src/pkg/YQPkgDiskUsageList.cc Thu Jan 10 12:28:06 2008
@@ -86,18 +86,14 @@
_items.insert( QString::fromUtf8(partitionDu.dir.c_str()), item );
}
}
- resizeColumnToContents( nameCol() );
+ resizeColumnToContents( totalSizeCol() );
resizeColumnToContents( usedSizeCol() );
resizeColumnToContents( freeSizeCol() );
- resizeColumnToContents( totalSizeCol() );
sortByColumn( percentageBarCol(), Qt::DescendingOrder );
- header()->setResizeMode( percentageBarCol(), QHeaderView::Stretch );
- header()->setResizeMode( totalSizeCol(), QHeaderView::Fixed );
- header()->setResizeMode( nameCol(), QHeaderView::ResizeToContents );
- header()->setResizeMode( usedSizeCol(), QHeaderView::ResizeToContents );
- header()->setResizeMode( freeSizeCol(), QHeaderView::ResizeToContents );
+ header()->setResizeMode( nameCol(), QHeaderView::Stretch );
+ header()->setResizeMode( QHeaderView::Interactive );
}
@@ -158,7 +154,7 @@
YQPkgDiskUsageList::sizeHint() const
{
QFontMetrics fms( font() );
- return QSize( fms.width( "/var/usr/home 100% 100.32GB" ) + 50, 100 );
+ return QSize( fms.width( "/var/usr/home 100% 100.32GB 100.3GB" ) + 50, 100 );
#ifdef FIXME
int width = header()->headerWidth()
Modified: trunk/qt/src/pkg/YQPkgObjList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgObjList.cc?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgObjList.cc (original)
+++ trunk/qt/src/pkg/YQPkgObjList.cc Thu Jan 10 12:28:06 2008
@@ -91,6 +91,7 @@
connect( this, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ),
this, SLOT ( currentItemChangedInternal( QTreeWidgetItem * ) ) );
+ setIconSize( QSize( 22, 16 ) );
}
@@ -706,7 +707,7 @@
Q_CHECK_PTR( item );
item->setText( nameCol() >= 0 ? nameCol() : 0, text );
- item->setBackgroundColor( QColor( 0xE0, 0xE0, 0xF8 ) );
+ item->setBackgroundColor( 0, QColor( 0xE0, 0xE0, 0xF8 ) );
}
@@ -1047,6 +1048,7 @@
{
if ( statusCol() >= 0 )
{
+ y2debug( "setStatusIcon" );
bool enabled = editable() && _pkgObjList->editable();
setIcon( statusCol(), _pkgObjList->statusIcon( status(), enabled, bySelection() ) );
}
Modified: trunk/qt/src/pkg/YQPkgPatchList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgPatchList.cc?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgPatchList.cc (original)
+++ trunk/qt/src/pkg/YQPkgPatchList.cc Thu Jan 10 12:28:06 2008
@@ -253,7 +253,7 @@
Q_CHECK_PTR( item );
item->setText( 1, text );
- item->setBackgroundColor( QColor( 0xE0, 0xE0, 0xF8 ) );
+ item->setBackgroundColor( 0, QColor( 0xE0, 0xE0, 0xF8 ) );
}
@@ -482,9 +482,9 @@
switch ( _patchCategory )
{
- case YQPkgYaSTPatch: setTextColor( QColor( 0, 0, 0xC0 ) ); break; // medium blue
- case YQPkgSecurityPatch: setTextColor( Qt::red ); break;
- case YQPkgRecommendedPatch: setTextColor( QColor( 0, 0, 0xC0 ) ); break; // medium blue
+ case YQPkgYaSTPatch: setTextColor( 0, QColor( 0, 0, 0xC0 ) ); break; // medium blue
+ case YQPkgSecurityPatch: setTextColor( 0, Qt::red ); break;
+ case YQPkgRecommendedPatch: setTextColor( 0, QColor( 0, 0, 0xC0 ) ); break; // medium blue
case YQPkgOptionalPatch: break;
case YQPkgDocumentPatch: break;
case YQPkgUnknownPatchCategory: break;
Modified: trunk/qt/src/pkg/YQPkgPatternList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgPatternList.cc?rev=43518&r1=43517&r2=43518&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgPatternList.cc (original)
+++ trunk/qt/src/pkg/YQPkgPatternList.cc Thu Jan 10 12:28:06 2008
@@ -43,8 +43,9 @@
{
y2debug( "Creating pattern list" );
- int numCol = 0;
+ int numCol = 1;
QStringList headers;
+ headers << "";
headers << ""; _statusCol = numCol++;
// Translators: "Pattern" refers to so-called "installation patterns",
@@ -56,7 +57,9 @@
headers << _( "Pattern" ); _summaryCol = numCol++;
+ setColumnCount( 3 );
setHeaderLabels(headers);
+
// Can use the same colum for "broken" and "satisfied":
// Both states are mutually exclusive
@@ -66,8 +69,20 @@
// header()->setStretchEnabled( _statusCol , false );
// header()->setStretchEnabled( _summaryCol, true );
+ setSortingEnabled( true );
+ sortByColumn( summaryCol(), Qt::AscendingOrder );
+
setAllColumnsShowFocus( true );
- //setTreeStepSize( 0 );
+
+ header()->setResizeMode( statusCol(), QHeaderView::Fixed );
+ header()->setResizeMode( summaryCol(), QHeaderView::Stretch );
+
+ header()->resizeSection( statusCol(), 25 );
+ setColumnWidth( statusCol(), 25 );
+ setColumnWidth( summaryCol(), 100 );
+ header()->resizeSection( 0, 0 );
+
+ //header()->setMinimumSectionSize( 25 );
if ( autoFilter )
{
@@ -309,6 +324,7 @@
_zyppPattern = tryCastToZyppPattern( selectable()->theObj() );
setStatusIcon();
+ setFirstColumnSpanned ( false );
}
@@ -347,7 +363,7 @@
, _patternList( patternList )
{
setText( _patternList->summaryCol(), category );
- setBackgroundColor( CATEGORY_BACKGROUND );
+ setBackgroundColor( _patternList->summaryCol(), CATEGORY_BACKGROUND );
setExpanded( true );
setTreeIcon();
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org