-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : SalomeApp_ListView.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
+#include "utilities.h"
+
#include <QValidator>
#include <QToolButton>
#include <QPixmap>
setRootIsDecorated(false);
setAllColumnsShowFocus(false);
// header()->setClickEnabled(false);
- header()->setMovable(false);
+ header()->setSectionsMovable(false);
myEditedItem = 0;
myEdit = 0;
viewport()->installEventFilter(this);
connect(this, SIGNAL(itemSelectionChanged()),
- this, SLOT(onSelectionChanged()));
+ this, SLOT(onSelectionChanged()));
connect(header(), SIGNAL(sizeChange(int, int, int)),
- this, SLOT(onHeaderSizeChange(int, int, int)));
+ this, SLOT(onHeaderSizeChange(int, int, int)));
}
/*!
if (ok) {
aNeedsUpdate = myEditedItem->finishEditing(myEdit);
if (aNeedsUpdate == utCancel) {
- // something to do here on Cancel...
+ // something to do here on Cancel...
}
else {
- // something to do here on OK...
+ // something to do here on OK...
}
// updating contents
switch (aNeedsUpdate) {
\retval valid rect in success
*/
QRect SalomeApp_ListView::tip(QPoint aPos,
- QString& aText,
- QRect& dspRect,
- QFont& dspFnt) const
+ QString& aText,
+ QRect& dspRect,
+ QFont& dspFnt) const
{
QRect result( -1, -1, -1, -1 );
SalomeApp_ListViewItem* aItem = (SalomeApp_ListViewItem*)itemAt( aPos );
QRect aItemRect = aItem->itemRect(i);
QRect aTextRect = aItem->textRect(i);
if ( !aItem->text(i).isEmpty() &&
- ( aItemRect.width() > header()->sectionSize(i) ||
- aTextRect.left() < 0 ||
+ ( aItemRect.width() > header()->sectionSize(i) ||
+ aTextRect.left() < 0 ||
aTextRect.top() < 0 ||
aTextRect.right() > viewport()->width() ||
aTextRect.bottom() > viewport()->height() ) ) {
// calculating tip data
aText = aItem->tipText();
- dspRect = aItem->tipRect();
- dspFnt = font();
+ dspRect = aItem->tipRect();
+ dspFnt = font();
if (dspRect.isValid()) {
result = QRect(QPoint(0, aItemRect.top()),
QSize(viewport()->width(), aItemRect.height()));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after) :
+ SalomeApp_ListViewItem* after) :
QTreeWidgetItem( parent, after )
{
init();
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- const QStringList& theStrings,
- const bool theEditable) :
+ const QStringList& theStrings,
+ const bool theEditable) :
QTreeWidgetItem(parent, theStrings)
{
init();
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- const QStringList& theString,
- const bool theEditable) :
+ const QStringList& theString,
+ const bool theEditable) :
QTreeWidgetItem(parent, theString)
{
init();
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const QString& theValue,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
Constructor
*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
- SalomeApp_ListViewItem* after,
- const QString& theName,
- const QString& theValue,
- const bool theEditable) :
+ SalomeApp_ListViewItem* after,
+ const QString& theName,
+ const QString& theValue,
+ const bool theEditable) :
QTreeWidgetItem(parent, after)
{
setData(0,Qt::DisplayRole,QVariant(theName));
return 0;
aWidget = new SalomeApp_EntityEdit(aListView->viewport(),
anEditType,
- aValueType,
- aButtons & SalomeApp_EntityEdit::btApply,
- aButtons & SalomeApp_EntityEdit::btCancel);
+ aValueType,
+ aButtons & SalomeApp_EntityEdit::btApply,
+ aButtons & SalomeApp_EntityEdit::btCancel);
computeEditGeometry(this, aWidget);
fillWidgetWithValues(aWidget);
Adds item in combo box
*/
void SalomeApp_ComboBox::insertItem(const QString& theValue,
- int theIndex)
+ int theIndex)
{
if (duplicatesEnabled() || findItem(theValue) < 0)
QComboBox::insertItem(theIndex, theValue);
*/
void SalomeApp_ComboBox::insertList(const QStringList& theList)
{
- for (unsigned i = 0; i < theList.count(); i++)
+ for (int i = 0; i < theList.count(); i++)
insertItem(theList[i]);
}
Constructor
*/
SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent,
- int controlType,
- int valueType,
- bool butApply,
- bool butCancel) :
+ int controlType,
+ int valueType,
+ bool butApply,
+ bool butCancel) :
QWidget(parent),
myEdit(0),
myCombo(0),
Adds item in combo box, sets it current if theSetCurrent is true
*/
void SalomeApp_EntityEdit::insertItem(const QString& theValue,
- bool theSetCurrent,
- int theOrder)
+ bool theSetCurrent,
+ int theOrder)
{
if (myCombo) {
int aIndexAt = -1;
Adds items in combo box, sets item theCurrent as current
*/
void SalomeApp_EntityEdit::insertList(const QStringList& theList,
- const int theCurrent)
+ const int theCurrent)
{
if (myCombo)
myCombo->insertList(theList);
Adds item in combo box, sets it current if theSetCurrent is true
*/
void SalomeApp_EntityEdit::insertItem(const int theValue,
- bool theSetCurrent)
+ bool theSetCurrent)
{
if (myCombo) {
myCombo->insertItem(theValue);
Adds items in combo box, sets item theCurrent as current
*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList,
- const int theCurrent)
+ const int theCurrent)
{
if (myCombo)
myCombo->insertList(theList);
TColStd_ListIteratorOfListOfInteger aIter(theList);
for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
- if (theCurrent == i) {
+ if (theCurrent == (int)i) { //!< TODO: mismatch signed/unsigned
setText(QString::number(aIter.Value()));
break;
}
Adds item in combo box, sets it current if theSetCurrent is true
*/
void SalomeApp_EntityEdit::insertItem(const double theValue,
- bool theSetCurrent)
+ bool theSetCurrent)
{
if (myCombo) {
myCombo->insertItem(theValue);
Adds items in combo box, sets item theCurrent as current
*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList,
- const int theCurrent)
+ const int theCurrent)
{
if (myCombo)
myCombo->insertList(theList);
TColStd_ListIteratorOfListOfReal aIter(theList);
for (unsigned i = 0; aIter.More(); aIter.Next(), i++) {
- if (theCurrent == i) {
+ if (theCurrent == (int)i) { //!< TODO: mismatch signed/unsigned
setText(QString::number(aIter.Value()));
break;
}