-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-/*
- * ModuleBase_WidgetExprEditor.cpp
- *
- * Created on: Aug 28, 2014
- * Author: sbh
- */
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+//
+// 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.
+//
+// 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
+//
#include <ModuleBase_WidgetExprEditor.h>
#include <ModuleBase_Tools.h>
#include <QScrollBar>
#include <QFontMetrics>
#include <QPainter>
+#include <QStyle>
+#include <QAbstractItemView>
#include <memory>
#include <string>
QTextCursor aCursor = textCursor();
aCursor.select(QTextCursor::WordUnderCursor);
const QString aPrefix = aCursor.selectedText();
- if (!aPrefix.isEmpty() && aPrefix.at(aPrefix.length() - 1).isLetter()) {
- performCompletion(aPrefix);
- }
+ performCompletion(aPrefix);
}
void ExpressionEditor::performCompletion(const QString& theCompletionPrefix)
QPen anOldpen = aPainter.pen();
aPainter.setPen( aColor );
lineRect.adjust(minLB, 0, 0, 0);
- QString elidedText = aFontMetrics.elidedText( myPlaceHolderText, Qt::ElideRight, lineRect.width() );
+ QString elidedText =
+ aFontMetrics.elidedText( myPlaceHolderText, Qt::ElideRight, lineRect.width() );
aPainter.drawText( lineRect, va, elidedText );
aPainter.setPen( anOldpen );
}
ModuleBase_WidgetExprEditor::ModuleBase_WidgetExprEditor( QWidget* theParent,
const Config_WidgetAPI* theData,
- const std::string& theParentId,
const std::string& thePlaceHolder )
- : ModuleBase_ModelWidget(theParent, theData, theParentId)
+: ModuleBase_ModelWidget(theParent, theData)
{
QVBoxLayout* aMainLay = new QVBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
{
}
-bool ModuleBase_WidgetExprEditor::storeValueCustom() const
+bool ModuleBase_WidgetExprEditor::storeValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if(!myFeature)
return false;
DataPtr aData = myFeature->data();
bool ModuleBase_WidgetExprEditor::restoreValueCustom()
{
- // A rare case when plugin was not loaded.
+ // A rare case when plugin was not loaded.
if(!myFeature)
return false;
DataPtr aData = myFeature->data();