summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/devicesinfo.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/sysinfo/devicesinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/devicesinfo.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/devicesinfo.cpp b/noncore/settings/sysinfo/devicesinfo.cpp
index 4bce65f..f1efb33 100644
--- a/noncore/settings/sysinfo/devicesinfo.cpp
+++ b/noncore/settings/sysinfo/devicesinfo.cpp
@@ -74,4 +74,6 @@ void DevicesView::selectionChanged( QListViewItem* item )
{
odebug << "DevicesView::selectionChanged to '" << item->text( 0 ) << "'" << oendl;
+ QWidget* details = ( static_cast<Device*>( item ) )->detailsWidget();
+ ( static_cast<DevicesInfo*>( parent() ) )->setDetailsWidget( details );
}
@@ -79,7 +81,7 @@ void DevicesView::selectionChanged( QListViewItem* item )
//=================================================================================================
DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl )
- :QWidget( parent, name, fl )
+ :QWidget( parent, name, fl ), details( 0 )
{
- OAutoBoxLayout *layout = new OAutoBoxLayout( this );
+ layout = new OAutoBoxLayout( this );
layout->setSpacing( 4 );
layout->setMargin( 4 );
@@ -88,4 +90,5 @@ DevicesInfo::DevicesInfo( QWidget* parent, const char* name, WFlags fl )
}
+
DevicesInfo::~DevicesInfo()
{
@@ -93,4 +96,13 @@ DevicesInfo::~DevicesInfo()
+void DevicesInfo::setDetailsWidget( QWidget* w )
+{
+ if ( details ) delete( details );
+ layout->addWidget( w );
+ w->show();
+}
+
+
+//=================================================================================================
Category::Category( DevicesView* parent, const QString& name )
:OListViewItem( parent, name )
@@ -113,4 +125,10 @@ Device::~Device()
}
+QWidget* Device::detailsWidget()
+{
+ return new QPushButton( static_cast<QWidget*>( listView()->parent() ), "Press Button to self-destruct" );
+}
+
+
//=================================================================================================
CpuCategory::CpuCategory( DevicesView* parent )