gephex--main--0.4--patch-1802
[email protected] Sun, 3 Oct 2004 03:48:58 +0200 (CEST)
Newsgroups
gmane.comp.video.gephex.devel
Message-ID
<[email protected] >
Archive: [email protected]
New revision: gephex--main--0.4--patch-1802
--
Revision: gephex--main--0.4--patch-1802
Archive: [email protected]
Creator: GePhex <[email protected] >
Date: Sun Oct 3 03:48:29 CEST 2004
Standard-date: 2004-10-03 01:48:29 GMT
Modified-files: qtgui/src/gui/base/propertyview.cpp
qtgui/src/gui/graphnameview.cpp
qtgui/src/gui/hidebutton.cpp qtgui/src/gui/hidebutton.h
New-patches: [email protected] /gephex--main--0.4--patch-1802
[email protected] /gephex--martin--0.4--patch-48
[email protected] /gephex--martin--0.4--patch-49
[email protected] /gephex--martin--0.4--patch-50
Summary: small gui fixes
Keywords:
Patches applied:
* [email protected] /gephex--martin--0.4--patch-48
dynamic resize of property table
* [email protected] /gephex--martin--0.4--patch-49
auto resize properties
* [email protected] /gephex--martin--0.4--patch-50
translate Status -> State
* added files
{arch}/gephex/gephex--main/gephex--main--0.4/[email protected] /patch-log/patch-1802
{arch}/gephex/gephex--martin/gephex--martin--0.4/[email protected] /patch-log/patch-48
{arch}/gephex/gephex--martin/gephex--martin--0.4/[email protected] /patch-log/patch-49
{arch}/gephex/gephex--martin/gephex--martin--0.4/[email protected] /patch-log/patch-50
* modified files
--- orig/qtgui/src/gui/base/propertyview.cpp
+++ mod/qtgui/src/gui/base/propertyview.cpp
@@ -45,45 +45,6 @@
deleteTable();
}
- namespace
- {
- QTable* buildNewTable(QWidget* parent)
- {
- int numberOfRows = NUM_ROWS;
-
- //QHBoxLayout* l = new QHBoxLayout(parent);
- //QScrollView* scroller = new QScrollView(parent);
- // l->addWidget(scroller);
-
- QTable* table = new QTable(numberOfRows, 3,
- parent,
- "Property Table");
-
- QHeader* header = table->horizontalHeader();
-
- header->setLabel(0,"Property", 85);
- header->setLabel(1,"Value", 115);
- header->setLabel(2,"hide", 30);
-
- table->setLeftMargin( 0 );
- table->verticalHeader()->hide();
- table->setShowGrid(false);
-
- // resize colum if content is larger then columsize
- /* for (int i = 0; i < 3; ++i)
- table->setColumnStretchable(i,true);*/
-
- for (int i = 0; i < numberOfRows; ++i)
- {
- table->setRowHeight(i,10);
- // table->setRowStretchable(i, true);
- }
- table->show();
-
- return table;
- }
- }
-
void PropertyView::deleteTable()
{
if (table != 0)
@@ -114,39 +75,55 @@
void PropertyView::displayProperties(const IPropertyDescription& desc)
{
+ deleteTable();
- this->deleteTable();
-
- table = buildNewTable(this);
- m_layout->addWidget(table);
- m_layout->activate();
-
std::list<PropertyEntry> entries = desc.getEntries();
+ table = new QTable( entries.size() , 3, this, "Property Table");
+
+ QHeader* header = table->horizontalHeader();
+
+ header->setLabel(0,"Property");
+ header->setLabel(1,"Value");
+ header->setLabel(2,"Hide");
+
+ table->setLeftMargin( 0 );
+ table->verticalHeader()->hide();
+ table->setShowGrid(false);
+
int rowIndex = 0;
- for (std::list<PropertyEntry>::const_iterator it = entries.begin();
- it != entries.end(); ++it)
+ for (std::list<PropertyEntry>::const_iterator entry = entries.begin();
+ entry != entries.end(); ++entry)
{
- const PropertyEntry& current = *it;
-
- table->setItem(rowIndex,0,new QTableItem( table, QTableItem::Never,
- current.getName().c_str()));
+ table->setText( rowIndex, 0, entry->getName().c_str());
+
+ const std::list<const IWidgetConstructor*>& wCtors
+ = entry->getWidgetCtors();
- const std::list<const IWidgetConstructor*>& wCtors = current.getWidgetCtors();
int colIndex = 1;
- for (std::list<const IWidgetConstructor*>::const_iterator it2 = wCtors.begin();
- it2 != wCtors.end(); ++it2)
+ for (std::list<const IWidgetConstructor*>::const_iterator ctor_it
+ = wCtors.begin();
+ ctor_it != wCtors.end(); ++ctor_it)
{
- const IWidgetConstructor* ctor = *it2;
- QWidget* widget = ctor->constructWidget(table);
+ QWidget* widget = (*ctor_it) -> constructWidget(table);
- if (table->rowHeight(rowIndex) < widget->height())
- table->setRowHeight(rowIndex, widget->height());
+ // grow row height and col width
+ /*
+ table->setRowHeight(rowIndex,
+ std::max(10,
+ std::max(table->rowHeight(rowIndex),
+ widget->sizeHint().height())));
+
+ table->setColumnWidth(colIndex,
+ std::max(10,
+ std::max(table->columnWidth(colIndex),
+ widget->sizeHint().width())));
+ */
table->setCellWidget(rowIndex,colIndex,widget);
widgetCtors.push_back(std::pair<const IWidgetConstructor*,
- QWidget*>(ctor,widget));
+ QWidget*>( *ctor_it , widget ));
++colIndex;
}
@@ -154,11 +131,28 @@
++rowIndex;
}
+ for (unsigned int col_index = 0;
+ col_index != 3; ++col_index)
+ {
+ table->adjustColumn ( col_index );
+ }
+
+ for (unsigned int row_index = 0;
+ row_index != table->numRows();
+ ++row_index)
+ {
+ table->adjustRow ( row_index );
+ }
+
+ m_layout->addWidget(table);
+ m_layout->activate();
+
+ table->show();
}
void PropertyView::undisplayProperties()
{
- this->deleteTable();
+ deleteTable();
}
} // end of namespace
--- orig/qtgui/src/gui/graphnameview.cpp
+++ mod/qtgui/src/gui/graphnameview.cpp
@@ -519,7 +519,7 @@
{
std::vector<std::string> cols;
cols.push_back("Name");
- cols.push_back("Status");
+ cols.push_back("State");
m_treeView = new TreeView(parent, "Graphs", cols);
m_treeView->insertItem(*m_topItem,0);
}
--- orig/qtgui/src/gui/hidebutton.cpp
+++ mod/qtgui/src/gui/hidebutton.cpp
@@ -30,30 +30,18 @@
HideButton::HideButton(QWidget* parent, InputPlugWidget& in)
: QCheckBox(parent, "oller knopf"), m_in(&in)
{
- this->setToggleButton(true);
+ set_state( !m_in->isVisible() );
connect(this, SIGNAL(toggled(bool)),
- this, SLOT(hasBeenToggled(bool)));
-
- if (m_in->isVisible())
- this->setChecked(false);
- else
- this->setChecked(true);
-
+ this, SLOT(set_state(bool)));
}
- void HideButton::hasBeenToggled(bool state)
+ void HideButton::set_state(bool state)
{
if (state)
- {
- m_in->setInvisible();
- // this->setChecked(false);
- }
+ m_in->setInvisible();
else
- {
- m_in->setVisible();
- // this->setChecked(true);
- }
+ m_in->setVisible();
}
} // end of namespace gui
--- orig/qtgui/src/gui/hidebutton.h
+++ mod/qtgui/src/gui/hidebutton.h
@@ -37,7 +37,7 @@
HideButton(QWidget* parent, InputPlugWidget& in);
private slots:
- void hasBeenToggled(bool);
+ void set_state(bool);
private: