Author: dmacvicar
Date: Tue Dec 4 17:42:34 2007
New Revision: 42674
URL: http://svn.opensuse.org/viewcvs/yast?rev=42674&view=rev
Log:
- trying to get disk usage to paint something, no sucess yet
- package selector still looks like tetris
Modified:
branches/tmp/coolo/qt4-port/src/CMakeLists.txt
branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.cc
branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.h
branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.cc
branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.h
branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelectorBase.cc
Modified: branches/tmp/coolo/qt4-port/src/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/CMakeLists.txt?rev=42674&r1=42673&r2=42674&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/CMakeLists.txt (original)
+++ branches/tmp/coolo/qt4-port/src/CMakeLists.txt Tue Dec 4 17:42:34 2007
@@ -50,7 +50,7 @@
INSTALL(TARGETS py2qt4 LIBRARY DESTINATION ${YAST_PLUGIN_DIR} )
-#ADD_SUBDIRECTORY(pkg)
+ADD_SUBDIRECTORY(pkg)
#SET_TARGET_PROPERTIES( y2lang_qt4 PROPERTIES PREFIX "" )
Modified: branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.cc?rev=42674&r1=42673&r2=42674&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.cc (original)
+++ branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.cc Tue Dec 4 17:42:34 2007
@@ -23,7 +23,95 @@
#include "QY2DiskUsageList.h"
#include "YQi18n.h"
-#include "qpainter.h"
+#include <QPainter>
+
+
+/**
+ * Stolen from KDirStat::KDirTreeView with the author's permission.
+ **/
+QColor
+contrastingColor( const QColor & desiredColor,
+ const QColor & contrastColor )
+{
+ if ( desiredColor != contrastColor )
+ {
+ return desiredColor;
+ }
+
+ if ( contrastColor != contrastColor.light() )
+ {
+ // try a little lighter
+ return contrastColor.light();
+ }
+ else
+ {
+ // try a little darker
+ return contrastColor.dark();
+ }
+}
+
+/**
+ * Interpolate ( translate ) a value 'from' in the range between 'minFrom'
+ * and 'maxFrom' to a range between 'minTo' and 'maxTo'.
+ **/
+static int
+interpolate( int from,
+ int minFrom, int maxFrom,
+ int minTo, int maxTo )
+{
+ if ( minFrom > maxFrom )
+ {
+ // Swap min/max values
+
+ int tmp = maxFrom;
+ maxFrom = minFrom;
+ minFrom = tmp;
+ }
+
+ long x = from - minFrom;
+ x *= maxTo - minTo;
+ x /= maxFrom - minFrom;
+ x += minTo;
+
+ if ( minTo < maxTo )
+ {
+ if ( x < minTo ) x = minTo;
+ if ( x > maxTo ) x = maxTo;
+ }
+ else
+ {
+ if ( x < maxTo ) x = maxTo;
+ if ( x > minTo ) x = minTo;
+ }
+
+ return (int) x;
+}
+
+/**
+ * Interpolate ( in the HSV color space ) a color between 'minColor' and
+ * 'maxColor' for a current value 'val' so that 'minVal' corresponds to
+ * 'minColor' and 'maxVal' to 'maxColor'.
+ *
+ * Returns the interpolated color.
+ **/
+static QColor
+interpolateColor( int val,
+ int minVal,
+ int maxVal,
+ const QColor & minColor,
+ const QColor & maxColor )
+{
+ int minH, maxH;
+ int minS, maxS;
+ int minV, maxV;
+
+ minColor.getHsv( &minH, &minS, &minV );
+ maxColor.getHsv( &maxH, &maxS, &maxV );
+
+ return QColor::fromHsv( interpolate( val, minVal, maxVal, minH, maxH ),
+ interpolate( val, minVal, maxVal, minS, maxS ),
+ interpolate( val, minVal, maxVal, minV, maxV ) );
+}
QY2DiskUsageList::QY2DiskUsageList( QWidget * parent, bool addStdColumns )
@@ -73,7 +161,39 @@
}
+void QY2DiskUsageList::drawRow( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const
+{
+ if ( index.column() == percentageBarCol() )
+ {
+ QColor background = option.palette.color(QPalette::Base);
+ painter->setBackground( background );
+
+ QY2DiskUsageListItem *item = dynamic_cast(itemFromIndex(index));
+ if ( item )
+ {
+ item->paintPercentageBar( item->usedPercent(),
+ painter,
+ option,
+ interpolateColor( item->usedPercent(),
+ 60, 95,
+ QColor( 0, 0x80, 0 ), // Medium dark green
+ QColor( 0xFF, 0, 0 ) ), // Bright red
+ background.dark( 115 ) );
+ }
+ }
+ else
+ {
+ //QColorGroup cg( colorGroup );
+
+ //if ( usedSize() > totalSize() )
+ // cg.setColor( QColorGroup::Text, Qt::red ); // Set red text foreground
+
+ // Intentionally bypassing the direct parent class method, use the grandparent's:
+ // Don't let QY2ListViewItem::_textColor / _backgroundColor interfere with our colors.
+ QTreeWidget::drawRow( painter, option, index );
+ }
+}
@@ -209,210 +329,94 @@
return QY2ListViewItem::compare( otherListViewItem, col, ascending );
}
-/*
-void
-QY2DiskUsageListItem::paintCell( QPainter * painter,
- const QColorGroup & colorGroup,
- int column,
- int width,
- int alignment )
-{
- if ( column == percentageBarCol() )
- {
- QColor background = colorGroup.base();
- painter->setBackgroundColor( background );
-
- paintPercentageBar( usedPercent(),
- painter,
- _diskUsageList->treeStepSize() * depth(),
- width,
- interpolateColor( usedPercent(),
- 60, 95,
- QColor( 0, 0x80, 0 ), // Medium dark green
- QColor( 0xFF, 0, 0 ) ), // Bright red
- background.dark( 115 ) );
-
- }
- else
- {
- QColorGroup cg( colorGroup );
-
- if ( usedSize() > totalSize() )
- cg.setColor( QColorGroup::Text, Qt::red ); // Set red text foreground
-
- // Intentionally bypassing the direct parent class method, use the grandparent's:
- // Don't let QY2ListViewItem::_textColor / _backgroundColor interfere with our colors.
-
- Q3ListViewItem::paintCell( painter, cg, column, width, alignment );
- }
-}
-*/
-
/**
* Stolen from KDirStat::KDirTreeView with the author's permission.
**/
void
QY2DiskUsageListItem::paintPercentageBar( float percent,
QPainter * painter,
- int indent,
- int width,
+ QStyleOptionViewItem option,
const QColor & fillColor,
const QColor & barBackground )
{
-// if ( percent > 100.0 ) percent = 100.0;
-// if ( percent < 0.0 ) percent = 0.0;
-// int penWidth = 2;
-// int extraMargin = 3;
-// int x = 0; /*FIXME _diskUsageList->itemMargin(); */
-// int y = extraMargin;
-// int w = width - 2; /*FIXME * _diskUsageList->horizontalOffset(); */
-// int h = height() - 2; /*FIXME * extraMargin; */
-// int fillWidth;
-//
-// painter->eraseRect( 0, 0, width, height() );
-// w -= indent;
-// x += indent;
-//
-// if ( w > 0 )
-// {
-// QPen pen( painter->pen() );
-// pen.setWidth(0);
-// painter->setPen( pen );
-// painter->setBrush( Qt::NoBrush );
-// fillWidth = (int) ( ( w - 2 * penWidth ) * percent / 100.0 );
-//
-//
-// // Fill bar background.
-//
-// painter->fillRect( x + penWidth, y + penWidth,
-// w - 2 * penWidth + 1, h - 2 * penWidth + 1,
-// barBackground );
-// /*
-// * Notice: The Xlib XDrawRectangle() function always fills one
-// * pixel less than specified. Altough this is very likely just a
-// * plain old bug, it is documented that way. Obviously, Qt just
-// * maps the fillRect() call directly to XDrawRectangle() so they
-// * inherited that bug ( although the Qt doc stays silent about
-// * it ). So it is really necessary to compensate for that missing
-// * pixel in each dimension.
-// *
-// * If you don't believe it, see for yourself.
-// * Hint: Try the xmag program to zoom into the drawn pixels.
-// **/
-//
-// // Fill the desired percentage.
-//
-// painter->fillRect( x + penWidth, y + penWidth,
-// fillWidth+1, h - 2 * penWidth+1,
-// fillColor );
-//
-//
-// // Draw 3D shadows.
-//
-// pen.setColor( contrastingColor ( Qt::black,
-// painter->backgroundColor() ) );
-// painter->setPen( pen );
-// painter->drawLine( x, y, x+w, y );
-// painter->drawLine( x, y, x, y+h );
-//
-// pen.setColor( contrastingColor( barBackground.dark(),
-// painter->backgroundColor() ) );
-// painter->setPen( pen );
-// painter->drawLine( x+1, y+1, x+w-1, y+1 );
-// painter->drawLine( x+1, y+1, x+1, y+h-1 );
-//
-// pen.setColor( contrastingColor( barBackground.light(),
-// painter->backgroundColor() ) );
-// painter->setPen( pen );
-// painter->drawLine( x+1, y+h, x+w, y+h );
-// painter->drawLine( x+w, y, x+w, y+h );
-//
-// pen.setColor( contrastingColor( Qt::white,
-// painter->backgroundColor() ) );
-// painter->setPen( pen );
-// painter->drawLine( x+2, y+h-1, x+w-1, y+h-1 );
-// painter->drawLine( x+w-1, y+1, x+w-1, y+h-1 );
-// }
+ if ( percent > 100.0 ) percent = 100.0;
+ if ( percent < 0.0 ) percent = 0.0;
+ int penWidth = 2;
+ int extraMargin = 3;
+ int x = 0; /*FIXME _diskUsageList->itemMargin(); */
+ int y = extraMargin;
+ int w = option.rect.width() - 2; /*FIXME * _diskUsageList->horizontalOffset(); */
+ int h = option.rect.height() - 2; /*FIXME * extraMargin; */
+ int fillWidth;
+
+ painter->eraseRect( 0, 0, option.rect.width(), option.rect.height() );
+ int indent=0;
+ w -= indent;
+ x += indent;
+
+ if ( w > 0 )
+ {
+ QPen pen( painter->pen() );
+ pen.setWidth(0);
+ painter->setPen( pen );
+ painter->setBrush( Qt::NoBrush );
+ fillWidth = (int) ( ( w - 2 * penWidth ) * percent / 100.0 );
+
+
+ // Fill bar background.
+
+ painter->fillRect( x + penWidth, y + penWidth,
+ w - 2 * penWidth + 1, h - 2 * penWidth + 1,
+ barBackground );
+ /*
+ * Notice: The Xlib XDrawRectangle() function always fills one
+ * pixel less than specified. Altough this is very likely just a
+ * plain old bug, it is documented that way. Obviously, Qt just
+ * maps the fillRect() call directly to XDrawRectangle() so they
+ * inherited that bug ( although the Qt doc stays silent about
+ * it ). So it is really necessary to compensate for that missing
+ * pixel in each dimension.
+ *
+ * If you don't believe it, see for yourself.
+ * Hint: Try the xmag program to zoom into the drawn pixels.
+ **/
+
+ // Fill the desired percentage.
+
+ painter->fillRect( x + penWidth, y + penWidth,
+ fillWidth+1, h - 2 * penWidth+1,
+ fillColor );
+
+
+ // Draw 3D shadows.
+
+ pen.setColor( contrastingColor ( Qt::black,
+ painter->background().color() ) );
+ painter->setPen( pen );
+ painter->drawLine( x, y, x+w, y );
+ painter->drawLine( x, y, x, y+h );
+
+ pen.setColor( contrastingColor( barBackground.dark(),
+ painter->background().color() ) );
+ painter->setPen( pen );
+ painter->drawLine( x+1, y+1, x+w-1, y+1 );
+ painter->drawLine( x+1, y+1, x+1, y+h-1 );
+
+ pen.setColor( contrastingColor( barBackground.light(),
+ painter->background().color() ) );
+ painter->setPen( pen );
+ painter->drawLine( x+1, y+h, x+w, y+h );
+ painter->drawLine( x+w, y, x+w, y+h );
+
+ pen.setColor( contrastingColor( Qt::white,
+ painter->background().color() ) );
+ painter->setPen( pen );
+ painter->drawLine( x+2, y+h-1, x+w-1, y+h-1 );
+ painter->drawLine( x+w-1, y+1, x+w-1, y+h-1 );
+ }
}
-/**
- * Stolen from KDirStat::KDirTreeView with the author's permission.
- **/
-QColor
-QY2DiskUsageListItem::contrastingColor( const QColor & desiredColor,
- const QColor & contrastColor )
-{
- if ( desiredColor != contrastColor )
- {
- return desiredColor;
- }
-
- if ( contrastColor != contrastColor.light() )
- {
- // try a little lighter
- return contrastColor.light();
- }
- else
- {
- // try a little darker
- return contrastColor.dark();
- }
-}
-
-
-QColor
-QY2DiskUsageListItem::interpolateColor( int val,
- int minVal,
- int maxVal,
- const QColor & minColor,
- const QColor & maxColor )
-{
- int minH, maxH;
- int minS, maxS;
- int minV, maxV;
-
- minColor.getHsv( &minH, &minS, &minV );
- maxColor.getHsv( &maxH, &maxS, &maxV );
-
- return QColor::fromHsv( interpolate( val, minVal, maxVal, minH, maxH ),
- interpolate( val, minVal, maxVal, minS, maxS ),
- interpolate( val, minVal, maxVal, minV, maxV ) );
-}
-
-
-int
-QY2DiskUsageListItem::interpolate( int from,
- int minFrom, int maxFrom,
- int minTo, int maxTo )
-{
- if ( minFrom > maxFrom )
- {
- // Swap min/max values
-
- int tmp = maxFrom;
- maxFrom = minFrom;
- minFrom = tmp;
- }
-
- long x = from - minFrom;
- x *= maxTo - minTo;
- x /= maxFrom - minFrom;
- x += minTo;
-
- if ( minTo < maxTo )
- {
- if ( x < minTo ) x = minTo;
- if ( x > maxTo ) x = maxTo;
- }
- else
- {
- if ( x < maxTo ) x = maxTo;
- if ( x > minTo ) x = minTo;
- }
-
- return (int) x;
-}
Modified: branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.h?rev=42674&r1=42673&r2=42674&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.h (original)
+++ branches/tmp/coolo/qt4-port/src/QY2DiskUsageList.h Tue Dec 4 17:42:34 2007
@@ -64,6 +64,8 @@
int deviceNameCol() const { return _deviceNameCol; }
+ virtual void drawRow ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
+
protected:
int _nameCol;
@@ -227,6 +229,7 @@
int width,
int alignment );
*/
+ public:
/**
* Paint a percentage bar into a @ref QListViewItem cell.
* 'width' is the width of the entire cell.
@@ -236,39 +239,11 @@
**/
void paintPercentageBar( float percent,
QPainter * painter,
- int indent,
- int width,
+ QStyleOptionViewItem option,
const QColor & fillColor,
const QColor & barBackground );
- /**
- * Return a color that contrasts to 'contrastColor'.
- *
- * Stolen from KDirStat::KDirTreeView with the author's permission.
- **/
- QColor contrastingColor ( const QColor & desiredColor,
- const QColor & contrastColor );
-
- /**
- * Interpolate ( in the HSV color space ) a color between 'minColor' and
- * 'maxColor' for a current value 'val' so that 'minVal' corresponds to
- * 'minColor' and 'maxVal' to 'maxColor'.
- *
- * Returns the interpolated color.
- **/
- virtual QColor interpolateColor( int val,
- int minVal,
- int maxVal,
- const QColor & minColor,
- const QColor & maxColor );
-
- /**
- * Interpolate ( translate ) a value 'from' in the range between 'minFrom'
- * and 'maxFrom' to a range between 'minTo' and 'maxTo'.
- **/
- int interpolate( int from,
- int minFrom, int maxFrom,
- int minTo, int maxTo );
+ protected:
//
Modified: branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.cc?rev=42674&r1=42673&r2=42674&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.cc (original)
+++ branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.cc Tue Dec 4 17:42:34 2007
@@ -28,6 +28,8 @@
#include <fstream>
#include
+#include <QHBoxLayout>
+#include <QVBoxLayout>
#include <QAction>
#include <QShortcut>
#include <QApplication>
@@ -213,13 +215,20 @@
void
YQPackageSelector::basicLayout()
{
- layoutMenuBar( this );
+
+ layoutMenuBar(layout());
QSplitter * outer_splitter = new QSplitter( Qt::Horizontal, this );
+ QVBoxLayout *layout = new QVBoxLayout(outer_splitter);
+ outer_splitter->setLayout(layout);
+
Q_CHECK_PTR( outer_splitter );
- QWidget * left_pane = layoutLeftPane ( outer_splitter );
- QWidget * right_pane = layoutRightPane( outer_splitter );
+ QWidget * left_pane = layoutLeftPane ( outer_splitter->layout() );
+ this->layout()->addWidget(left_pane);
+
+ QWidget * right_pane = layoutRightPane( outer_splitter->layout() );
+ this->layout()->addWidget(right_pane);
outer_splitter->setResizeMode( left_pane, QSplitter::KeepSize );
outer_splitter->setResizeMode( right_pane, QSplitter::Stretch );
@@ -227,21 +236,29 @@
QWidget *
-YQPackageSelector::layoutLeftPane( QWidget * parent )
+YQPackageSelector::layoutLeftPane( QLayout *parent_layout )
{
- QSplitter * splitter = new QSplitter( Qt::Vertical, parent );
+ QSplitter * splitter = new QSplitter( Qt::Vertical, this );
Q_CHECK_PTR( splitter );
splitter->setMargin( MARGIN );
+ parent_layout->addWidget(splitter);
- Q3VBox * upper_vbox = new Q3VBox( splitter );
+ QWidget * upper_vbox = new QWidget( splitter );
+ QVBoxLayout *layout = new QVBoxLayout(upper_vbox);
+ upper_vbox->setLayout(layout);
+
Q_CHECK_PTR( upper_vbox );
- layoutFilters( upper_vbox );
+ layoutFilters( upper_vbox->layout() );
addVSpacing( upper_vbox, MARGIN );
- Q3VBox * lower_vbox = new Q3VBox( splitter );
+ QWidget * lower_vbox = new QWidget( splitter );
+ layout = new QVBoxLayout(lower_vbox);
+ lower_vbox->setLayout(layout);
+
addVSpacing( lower_vbox, MARGIN );
_diskUsageList = new YQPkgDiskUsageList( lower_vbox );
Q_CHECK_PTR( _diskUsageList );
+ layout->addWidget(_diskUsageList);
splitter->setResizeMode( upper_vbox, QSplitter::Stretch );
splitter->setResizeMode( lower_vbox, QSplitter::KeepSize );
@@ -251,11 +268,11 @@
void
-YQPackageSelector::layoutFilters( QWidget * parent )
+YQPackageSelector::layoutFilters( QLayout *parent_layout )
{
- _filters = new QY2ComboTabWidget( _( "Fi<er:" ), parent );
+ _filters = new QY2ComboTabWidget( _( "Fi<er:" ), this );
Q_CHECK_PTR( _filters );
-
+ parent_layout->addWidget(_filters);
//
// Update problem view
@@ -266,7 +283,7 @@
if ( YQPkgUpdateProblemFilterView::haveProblematicPackages()
|| testMode() )
{
- _updateProblemFilterView = new YQPkgUpdateProblemFilterView( parent );
+ _updateProblemFilterView = new YQPkgUpdateProblemFilterView( this );
Q_CHECK_PTR( _updateProblemFilterView );
_filters->addPage( _( "Update Problems" ), _updateProblemFilterView );
}
@@ -291,7 +308,7 @@
if ( ! zyppPool().emptyzypp::Pattern() || testMode() )
{
- _patternList = new YQPkgPatternList( parent, true );
+ _patternList = new YQPkgPatternList( this, true );
Q_CHECK_PTR( _patternList );
_filters->addPage( _( "Patterns" ), _patternList );
@@ -316,7 +333,7 @@
if ( ! zyppPool().emptyzypp::Selection() || testMode() )
{
- _selList = new YQPkgSelList( parent, true );
+ _selList = new YQPkgSelList( this, true );
Q_CHECK_PTR( _selList );
_filters->addPage( _( "Selections" ), _selList );
@@ -338,7 +355,7 @@
// RPM group tags view
//
- _rpmGroupTagsFilterView = new YQPkgRpmGroupTagsFilterView( parent );
+ _rpmGroupTagsFilterView = new YQPkgRpmGroupTagsFilterView( this );
Q_CHECK_PTR( _rpmGroupTagsFilterView );
_filters->addPage( _( "Package Groups" ), _rpmGroupTagsFilterView );
@@ -350,7 +367,7 @@
// Languages view
//
- _langList = new YQPkgLangList( parent );
+ _langList = new YQPkgLangList( this );
Q_CHECK_PTR( _langList );
_filters->addPage( _( "Languages" ), _langList );
@@ -367,7 +384,7 @@
// Repository view
//
- _repoFilterView = new YQPkgRepoFilterView( parent );
+ _repoFilterView = new YQPkgRepoFilterView( this );
Q_CHECK_PTR( _repoFilterView );
_filters->addPage( _( "Repositories" ), _repoFilterView );
@@ -376,7 +393,7 @@
// Package search view
//
- _searchFilterView = new YQPkgSearchFilterView( parent );
+ _searchFilterView = new YQPkgSearchFilterView( this );
Q_CHECK_PTR( _searchFilterView );
_filters->addPage( _( "Search" ), _searchFilterView );
@@ -385,7 +402,7 @@
// Status change view
//
- _statusFilterView = new YQPkgStatusFilterView( parent );
+ _statusFilterView = new YQPkgStatusFilterView( this );
Q_CHECK_PTR( _statusFilterView );
_filters->addPage( _( "Installation Summary" ), _statusFilterView );
@@ -401,32 +418,44 @@
QWidget *
-YQPackageSelector::layoutRightPane( QWidget * parent )
+YQPackageSelector::layoutRightPane( QLayout *parent_layout )
{
- Q3VBox * right_pane_vbox = new Q3VBox( parent );
+ QWidget * right_pane_vbox = new QWidget( this );
+
+ QVBoxLayout *layout = new QVBoxLayout(right_pane_vbox);
+ right_pane_vbox->setLayout(layout);
+
Q_CHECK_PTR( right_pane_vbox );
- right_pane_vbox->setMargin( MARGIN );
+ parent_layout->addWidget(right_pane_vbox);
+
+ layout->setMargin( MARGIN );
+
QSplitter * splitter = new QSplitter( Qt::Vertical, right_pane_vbox );
Q_CHECK_PTR( splitter );
+ layout->addWidget(splitter);
+
+ QWidget * splitter_vbox = new QWidget( splitter );
+ layout = new QVBoxLayout(splitter_vbox);
+ splitter_vbox->setLayout(layout);
- Q3VBox * splitter_vbox = new Q3VBox( splitter );
Q_CHECK_PTR( splitter_vbox );
- layoutPkgList( splitter_vbox );
+ layoutPkgList( right_pane_vbox->layout() );
addVSpacing( splitter_vbox, MARGIN );
- layoutDetailsViews( splitter );
+ layoutDetailsViews( right_pane_vbox->layout() );
- layoutButtons( right_pane_vbox );
+ layoutButtons( right_pane_vbox->layout() );
return right_pane_vbox;
}
void
-YQPackageSelector::layoutPkgList( QWidget * parent )
+YQPackageSelector::layoutPkgList( QLayout *parent_layout )
{
- _pkgList= new YQPkgList( parent );
+ _pkgList= new YQPkgList( this );
+ parent_layout->addWidget(_pkgList);
Q_CHECK_PTR( _pkgList );
connect( _pkgList, SIGNAL( statusChanged() ),
@@ -435,17 +464,23 @@
void
-YQPackageSelector::layoutDetailsViews( QWidget * parent )
+YQPackageSelector::layoutDetailsViews( QLayout *parent_layout )
{
bool haveInstalledPkgs = YQPkgList::haveInstalledPkgs();
- Q3VBox * details_vbox = new Q3VBox( parent );
+ QWidget * details_vbox = new QWidget( this );
Q_CHECK_PTR( details_vbox );
- details_vbox->setMinimumSize( 0, 0 );
+ parent_layout->addWidget(details_vbox);
+
+ QVBoxLayout *layout = new QVBoxLayout(details_vbox);
+ details_vbox->setLayout(layout);
+ //details_vbox->setMinimumSize( 0, 0 );
addVSpacing( details_vbox, 8 );
_detailsViews = new QTabWidget( details_vbox );
+ layout->addWidget(_detailsViews);
+
Q_CHECK_PTR( _detailsViews );
_detailsViews->setMargin( MARGIN );
@@ -543,15 +578,22 @@
void
-YQPackageSelector::layoutButtons( QWidget * parent )
+YQPackageSelector::layoutButtons( QLayout *parent_layout )
{
- Q3HBox * button_box = new Q3HBox( parent );
+ QWidget * button_box = new QWidget( this );
Q_CHECK_PTR( button_box );
- button_box->setSpacing( SPACING );
+ parent_layout->addWidget(button_box);
+
+ QHBoxLayout *layout = new QHBoxLayout(button_box);
+ button_box->setLayout(layout);
+
+ layout->setSpacing( SPACING );
// Button: Dependency check
// Translators: Please keep this short!
_checkDependenciesButton = new QPushButton( _( "Chec&k" ), button_box );
+ layout->addWidget(_checkDependenciesButton);
+
Q_CHECK_PTR( _checkDependenciesButton );
_checkDependenciesButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
_normalButtonBackground = _checkDependenciesButton->paletteBackgroundColor();
@@ -564,12 +606,16 @@
// Translators: Please keep this short!
_autoDependenciesCheckBox = new QCheckBox( _( "A&utocheck" ), button_box );
Q_CHECK_PTR( _autoDependenciesCheckBox );
+ layout->addWidget(_autoDependenciesCheckBox);
+
_autoDependenciesCheckBox->setChecked( AUTO_CHECK_DEPENDENCIES_DEFAULT );
addHStretch( button_box );
QPushButton * cancel_button = new QPushButton( _( "&Cancel" ), button_box );
Q_CHECK_PTR( cancel_button );
+ layout->addWidget(cancel_button);
+
cancel_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
connect( cancel_button, SIGNAL( clicked() ),
@@ -578,6 +624,7 @@
QPushButton * accept_button = new QPushButton( _( "&Accept" ), button_box );
Q_CHECK_PTR( accept_button );
+ layout->addWidget(accept_button);
accept_button->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); // hor/vert
connect( accept_button, SIGNAL( clicked() ),
@@ -588,9 +635,10 @@
void
-YQPackageSelector::layoutMenuBar( QWidget * parent )
+YQPackageSelector::layoutMenuBar( QLayout *parent_layout )
{
- _menuBar = new QMenuBar( parent );
+ _menuBar = new QMenuBar( this );
+ parent_layout->addWidget(_menuBar);
Q_CHECK_PTR( _menuBar );
_fileMenu = 0;
Modified: branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.h?rev=42674&r1=42673&r2=42674&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.h (original)
+++ branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelector.h Tue Dec 4 17:42:34 2007
@@ -202,13 +202,13 @@
void basicLayout();
- QWidget * layoutLeftPane ( QWidget * parent );
- QWidget * layoutRightPane ( QWidget * parent );
- void layoutFilters ( QWidget * parent );
- void layoutPkgList ( QWidget * parent );
- void layoutDetailsViews ( QWidget * parent );
- void layoutButtons ( QWidget * parent );
- void layoutMenuBar ( QWidget * parent );
+ QWidget * layoutLeftPane ( QLayout *parent_layout );
+ QWidget * layoutRightPane ( QLayout *parent_layout );
+ void layoutFilters ( QLayout *parent_layout );
+ void layoutPkgList ( QLayout *parent_layout );
+ void layoutDetailsViews ( QLayout *parent_layout );
+ void layoutButtons ( QLayout *parent_layout );
+ void layoutMenuBar ( QLayout *parent_layout );
/**
* Establish Qt signal / slot connections.
Modified: branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelectorBase.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelectorBase.cc?rev=42674&r1=42673&r2=42674&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelectorBase.cc (original)
+++ branches/tmp/coolo/qt4-port/src/pkg/YQPackageSelectorBase.cc Tue Dec 4 17:42:34 2007
@@ -25,6 +25,7 @@
#include
#include <QAction>
+#include <QVBoxLayout>
#include "QY2LayoutUtils.h"
#include "YQPackageSelectorBase.h"
@@ -54,10 +55,8 @@
{
setWidgetRep( this );
-// QVBoxLayout *layout = new QVBoxLayout;
-// layout->addWidget(child1);
-// layout->addWidget(child2);
-// setLayout(layout);
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ setLayout(layout);
_showChangesDialog = false;
_pkgConflictDialog = 0;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org