IF(NOT SALOME_BUILD_WITH_QT5)
FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
INCLUDE(${QT_USE_FILE})
+ #SET(SALOME_USE_PVVIEWER OFF)
ELSE()
ADD_DEFINITIONS(-fPIC)
- #SET(CMAKE_AUTOMOC ON)
+# SET(CMAKE_AUTOMOC ON)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
FIND_PACKAGE(SalomeQt5 REQUIRED)
SET(SALOME_USE_PVVIEWER OFF)
ADD_DEFINITIONS("-DDISABLE_PLOT2DVIEWER")
ENDIF()
IF (SALOME_USE_PVVIEWER)
- find_package(ParaView REQUIRED)
- #FIND_PACKAGE(SalomeParaView)
+ FIND_PACKAGE(SalomeParaView)
SALOME_LOG_OPTIONAL_PACKAGE(ParaView SALOME_USE_PVVIEWER)
ELSE()
ADD_DEFINITIONS("-DDISABLE_PVVIEWER")
# Ensure the variables are always defined for the configure:
SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}")
-SET(QT_ROOT_DIR "${QT_ROOT_DIR}")
-SET(PYQT_ROOT_DIR "${PYQT_ROOT_DIR}")
+IF(NOT SALOME_BUILD_WITH_QT5)
+ SET(_QT_ROOT_DIR "${QT4_ROOT_DIR}")
+ELSE()
+ SET(_QT_ROOT_DIR "${QT5_ROOT_DIR}")
+ENDIF()
+IF(NOT SALOME_BUILD_WITH_PYQT5)
+ SET(_PYQT_ROOT_DIR "${PYQT4_ROOT_DIR}")
+ELSE()
+ SET(_PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}")
+ENDIF()
SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}")
SET(OPENGL_ROOT_DIR "${OPENGL_ROOT_DIR}")
SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
SALOME_CONFIGURE_PREPARE(CAS OpenGL Qwt SIP VTK)
IF(NOT SALOME_BUILD_WITH_QT5)
- SALOME_CONFIGURE_PREPARE(PyQt4 Qt4)
+ SALOME_CONFIGURE_PREPARE(Qt4)
+ELSE()
+ SALOME_CONFIGURE_PREPARE(Qt5)
+ENDIF()
+IF(NOT SALOME_BUILD_WITH_PYQT5)
+ SALOME_CONFIGURE_PREPARE(PyQt4)
ELSE()
- SALOME_CONFIGURE_PREPARE(PyQt5 Qt5)
+ SALOME_CONFIGURE_PREPARE(PyQt5)
ENDIF()
CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
- KERNEL_ROOT_DIR SIP_ROOT_DIR QT_ROOT_DIR PYQT_ROOT_DIR CAS_ROOT_DIR
+ KERNEL_ROOT_DIR SIP_ROOT_DIR _QT_ROOT_DIR _PYQT_ROOT_DIR CAS_ROOT_DIR
OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
# ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
# INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
-# KERNEL_ROOT_DIR SIP_ROOT_DIR QT5_ROOT_DIR PYQT5_ROOT_DIR CAS_ROOT_DIR
+# KERNEL_ROOT_DIR SIP_ROOT_DIR _QT_ROOT_DIR _PYQT_ROOT_DIR CAS_ROOT_DIR
# OPENGL_ROOT_DIR VTK_ROOT_DIR QWT_ROOT_DIR)
WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
int aFontCont = 0;
QString aFontDef = theFont->toString();
char** xFontList = XListFonts( aDisp, aFontDef.toLatin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if( !theFont->handle() )
+ {
+#endif
#ifdef _DEBUG_
- printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ );
+ printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ );
#endif
- QString aFontMask ("-*-*-*-r-*-*-");
- aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 );
+ QString aFontMask ("-*-*-*-r-*-*-");
+ aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 );
#ifdef _DEBUG_
- printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() );
+ printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() );
#endif
- aFontMask += "-*-*-*-m-*-*-*";
- xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont );
- if( aFontCont == 0 )
- {
+ aFontMask += "-*-*-*-m-*-*-*";
+ xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont );
+ if( aFontCont == 0 )
+ {
#ifdef _DEBUG_
- printf( "Can't load default font\n" );
+ printf( "Can't load default font\n" );
#endif
- return 0;
+ return 0;
+ }
+ glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
}
- glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase );
-
+ else
+ glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase );
+#endif
aList = listBase;
GLViewer_TexFont::BitmapFontCache[aFindFont] = aList;
}
if ( state == Fin )
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QApplication::syncX(); /* force rectangle redrawing */
+#else
QApplication::sync(); /* force rectangle redrawing */
+#endif
myViewer->activateSketching( GLViewer_Viewer::NoSketching );
}
}
-from PyQt5.QtCore import *
-from PyQt5.QtGui import *
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
import SalomePyQt
__author__="gboulant"
__date__ ="$31 mars 2010 17:09:53$"
-from PyQt5.QtGui import QDialog, QMessageBox
+from PyQt4.QtGui import QDialog, QMessageBox
from genericdialog_ui import Ui_GenericDialog
#
def TEST_GenericDialog():
import sys
- from PyQt5.QtGui import QApplication
- from PyQt5.QtCore import QObject, SIGNAL, SLOT
+ from PyQt4.QtGui import QApplication
+ from PyQt4.QtCore import QObject, SIGNAL, SLOT
app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
return name
-from PyQt5.QtCore import SIGNAL
+from PyQt4.QtCore import SIGNAL
class MyTestDialogWithSignals(MyTestDialog):
"""
This class is to illustrate the usage of the GenericDialog in the
def TEST_MyTestDialog_modal():
import sys
- from PyQt5.QtCore import QObject, SIGNAL, SLOT
- from PyQt5.QtGui import QApplication
+ from PyQt4.QtCore import QObject, SIGNAL, SLOT
+ from PyQt4.QtGui import QApplication
app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
def TEST_MyTestDialog_non_modal():
import sys
- from PyQt5.QtCore import QObject, SIGNAL, SLOT
- from PyQt5.QtGui import QApplication
+ from PyQt4.QtCore import QObject, SIGNAL, SLOT
+ from PyQt4.QtGui import QApplication
app = QApplication(sys.argv)
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
#
import os
-from PyQt5 import QtGui, QtCore
-from PyQt5.QtCore import Qt
+from PyQt4 import QtGui, QtCore
+from PyQt4.QtCore import Qt
import salome
from salome.kernel.studyedit import getStudyEditor
// Create OBSelector
new LightApp_OBSelector( ob, mySelMgr );
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ ob->treeView()->header()->setResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed);
+#else
ob->treeView()->header()->setSectionResizeMode(SUIT_DataObject::VisibilityId, QHeaderView::Fixed);
+#endif
ob->treeView()->header()->moveSection(SUIT_DataObject::NameId,SUIT_DataObject::VisibilityId);
ob->treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH);
ob->setProperty( "shortcut", QKeySequence( "Alt+Shift+O" ) );
#include <stdlib.h>
#if !defined WIN32
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QX11Info>
+#else
#include <QtGui/QX11Info>
+#endif
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
//#ifdef DEBUG
//cout << "Choosing cmap for vID = " << vi->visualid << endl;
//#endif
-
- /*if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) )
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) )
{
#ifdef DEBUG
// cout << "Using x11AppColormap" << endl;
#endif
return QX11Info::appColormap();
- }*/
-
+ }
+#endif
if ( mesa_gl )
{
Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
mapView( activeView() );
#endif
if ( !myWindow.IsNull() ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QApplication::syncX();
+#else
QApplication::sync();
+#endif
QRect rc = e->rect();
if ( !myPaintersRedrawing )
activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
if ( !mapped( activeView() ) )
mapView( activeView() );
#endif
- QApplication::sync();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QApplication::syncX();
+#else
+ QApplication::sync();
+#endif
if ( !activeView().IsNull() )
activeView()->MustBeResized();
}
if ( state == Fin )
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QApplication::syncX(); /* force rectangle redrawing */
+#else
QApplication::sync(); /* force rectangle redrawing */
+#endif
mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
}
}
mypPolyRB->clearGeometry();
mypPolyRB->hide();
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QApplication::syncX();
+#else
QApplication::sync();
+#endif
mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching );
}
}
#include <qwt_legend_label.h>
#include <qwt_plot_dict.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qdrawutil.h>
+#endif
const int SPACING = 10;
const int SYMBOL_SIZE = 13;
#include <QEvent>
#include <QMouseEvent>
#include <QContextMenuEvent>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QPrinter>
+#else
#include <QtPrintSupport/QPrinter>
+#endif
#include <QPalette>
#include <QLocale>
#include <QXmlStreamWriter>
#include <stdlib.h>
#include <limits>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <qprinter.h>
+#else
#include <QtPrintSupport/qprinter.h>
+#endif
#include <qwt_legend.h>
#include <qwt_scale_widget.h>
#include <QPaintEvent>
#include <QActionGroup>
#include <QPainter>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QPrinter>
+#include <QPrintDialog>
+#else
#include <QtPrintSupport/QPrinter>
#include <QtPrintSupport/QPrintDialog>
+#endif
#include <qwt_plot_curve.h>
#include <QFile>
#include <QTimer>
#ifndef QT_NO_DOM
-#include <QtXml/QDomDocument>
-#include <QtXml/QDomNode>
+#include <QDomDocument>
+#include <QDomNode>
#include <QCoreApplication>
#endif
void QtxDialog::emitSignal()
{
QApplication::instance()->processEvents();
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QApplication::syncX();
+#endif
int id = buttonId( (QAbstractButton*)mySender );
mySender = 0;
if ( o != menuBar() )
return false;
- if ( /*e->type() == QEvent::MenubarUpdated || */e->type() == QEvent::Resize )
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if ( e->type() == QEvent::MenubarUpdated || e->type() == QEvent::Resize )
+#else
+ if ( e->type() == QEvent::Resize )
+#endif
updateCorner();
if ( e->type() == QEvent::ChildAdded || e->type() == QEvent::ChildRemoved )
for ( ; anIt1 != aLast1 && anIt2 != aLast2; anIt1++, anIt2++ )
{
if ( (*anIt1) != (*anIt2) )
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return (*anIt1)<(*anIt2);
+#else
return (*anIt1)<=(*anIt2);
+#endif
}
return anIt1 == aLast1 && anIt2 != aLast2;
}
}
}
return t1 < t2;
-}
+}
/*!
\class QtxPopupMgr::PopupCreator
}
QString actLabel = strValue( attr, label );
- QKeySequence seq = QKeySequence( strValue( attr, accel ) );
QtxAction* newAct = new QtxAction( strValue( attr, tooltip ), set, actLabel,
- seq[0],
+ QKeySequence( strValue( attr, accel ) )[0],
myMgr );
newAct->setToolTip( strValue( attr, tooltip ) );
QString toggleact = strValue( attr, toggle );
#include <QLibraryInfo>
#include <QtDebug>
#ifndef QT_NO_DOM
-#include <QtXml/QDomDocument>
-#include <QtXml/QDomElement>
-#include <QtXml/QDomNode>
+#include <QDomDocument>
+#include <QDomElement>
+#include <QDomNode>
#endif
#include <stdlib.h>
QVariant appropriate = model()->headerData( i, orientation(), Qtx::AppropriateRole );
QIcon icon;
if ( iconData.isValid() ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if ( qVariantCanConvert<QIcon>( iconData ) )
+ icon = qVariantValue<QIcon>( iconData );
+ else if ( qVariantCanConvert<QPixmap>( iconData ) )
+ icon = qVariantValue<QPixmap>( iconData );
+#else
if ( iconData.canConvert( QMetaType::QIcon ) )
icon = iconData.value<QIcon>();
else if ( iconData.canConvert( QMetaType::QPixmap ) )
icon = iconData.value<QPixmap>();
+#endif
}
if( ( !lab.isEmpty() || !icon.isNull() ) &&
appropriate.isValid() ? appropriate.toInt()==Qtx::Toggled : true )
}
else if ( a && a == sortAction ) {
setSortIndicatorShown( a->isChecked() );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ setClickable( a->isChecked() );
+#else
setSectionsClickable( a->isChecked() );
+#endif
QtxTreeView* view = qobject_cast<QtxTreeView*>( parent() );
if ( view ) {
view->emitSortingEnabled( a->isChecked() );
: QTreeView( parent )
{
setHeader( new Header( false, this ) );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ header()->setMovable( true );
+#else
header()->setSectionsMovable( true );
+#endif
}
/*!
: QTreeView( parent )
{
setHeader( new Header( enableSortMenu, this ) );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ header()->setMovable( true );
+#else
header()->setSectionsMovable( true );
+#endif
}
/*!
#include <QStatusBar>
#include <QToolBar>
#include <QVBoxLayout>
-#include <QtWebKit/QWebView>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QWebView>
+#else
+#include <QtWebKitWidgets/QWebView>
+#endif
#include <QProcess>
namespace
%Import QtGui/QtGuimod.sip
%Import QtCore/QtCoremod.sip
+%If (Qt_5_0_0 -)
%Import QtWidgets/QtWidgetsmod.sip
+%End
%Import QtXmlmod.sip
%Import QtGui/QtGuimod.sip
%Import QtCore/QtCoremod.sip
+%If (Qt_5_0_0 -)
%Import QtWidgets/QtWidgetsmod.sip
+%End
%Import QtXmlmod.sip
%If (ENABLE_PLOT2D)
setWindowIcon( parent->windowIcon() );
// GDD
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation)));
+ myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+#else
myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)));
myUrls.insert(0,QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::HomeLocation)));
+#endif
setSidebarUrls(myUrls);
// add quick directories widgets
#include <QPushButton>
#include <QTextStream>
#include <QFile>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QPrinter>
+#else
#include <QtPrintSupport/QPrinter>
+#endif
//#include <QSimpleRichText>
#include <QTextDocument>
#include <QPainter>
int n = myColumns.size();
myColumns.resize( n+1 );
myColumns[n] = inf;
- //reset();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ reset();
+#endif
}
}
myColumns[i].myIds.remove( group_id );
if ( myColumns[i].myIds.isEmpty() ) {
myColumns.remove( i );
- //reset();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ reset();
+#endif
}
break;
}
myRoot = r;
//initialize();
- //reset();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ reset();
+#endif
emit modelUpdated();
}
//Set a "native" graphic system in case if application runs on the remote host
QString remote(::getenv("REMOTEHOST"));
QString client(::getenv("SSH_CLIENT"));
- /*if(remote.length() > 0 || client.length() > 0 ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if(remote.length() > 0 || client.length() > 0 ) {
QApplication::setGraphicsSystem(QLatin1String("native"));
- }*/
+ }
+#endif
SUITApp_Application app( argc, argv );
QString cfgAppName = getAppName( argList.isEmpty() ? QString() : argList.first() );
#ifdef ENABLE_TESTRECORDER
: TestApplication( argc, argv ),
#else
-//#ifndef WIN32
+#if !defined(WIN32) && (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
// san: Opening an X display and choosing a visual most suitable for 3D visualization
// in order to make SALOME viewers work with non-native X servers
- // : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
-//#else
+ : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
+#else
: QApplication( argc, argv ),
-//#endif
+#endif
#endif
myExceptHandler( hand )
{
/*!
Constructor
*/
-/*SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
#ifdef ENABLE_TESTRECORDER
: TestApplication( argc, argv ),
#else
myExceptHandler( hand )
{
}
-*/
+#endif
/*!
Sends event to receiver
\return the value that is returned from the receiver's event handler
public:
SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* = 0 );
- //SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* = 0 );
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* = 0 );
+#endif
virtual bool notify( QObject* receiver, QEvent* e );
SUIT_ExceptionHandler* handler() const;
#endif
}
-/*
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef WIN32
/*!
To handle native Win32 events (from such devices as SpaceMouse)
*/
-/*bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result )
+bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result )
{
// TODO: Implement event handling for SpaceMouse
return QWidget::winEvent( msg, result);
}
#else
-*/
+
/*!
To handle native X11 events (from such devices as SpaceMouse)
*/
-/*bool
+bool
QVTK_RenderWindowInteractor
::x11Event( XEvent *xEvent )
{
return QWidget::x11Event( xEvent );
}
-#endif */
+#endif
+#endif
/*!
Constructor
*/
virtual void focusInEvent( QFocusEvent* );
virtual void focusOutEvent( QFocusEvent* );
-/* //! To handle native events (from such devices as SpaceMouse)
+ //! To handle native events (from such devices as SpaceMouse)
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef WIN32
virtual bool winEvent( MSG*, long* );
#else
virtual bool x11Event( XEvent *e );
-#endif */
+#endif
+#endif
vtkSmartPointer<vtkRenderWindow> myRenderWindow;
vtkSmartPointer<vtkGenericRenderWindowInteractor> myDevice;
};
setRootIsDecorated(false);
setAllColumnsShowFocus(false);
// header()->setClickEnabled(false);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ header()->setMovable(false);
+#else
header()->setSectionsMovable(false);
+#endif
myEditedItem = 0;
myEdit = 0;
# --- scripts ---
# scripts / static
-# TODO: process UIC files via PyQt5 pyuic tool, see UsePyQt5.cmake
+# TODO: process UIC files via PyQt pyuic tool, see UsePyQt.cmake
SET(_plugins_SCRIPTS
minmax_dialog.py
minmax_plugin.py
# Form implementation generated from reading ui file 'minmax.ui'
#
# Created: Thu Mar 1 15:23:57 2012
-# by: PyQt5 UI code generator 5.5.0
+# by: PyQt4 UI code generator 4.8.1
#
# WARNING! All changes made in this file will be lost!
-from PyQt5 import QtCore, QtGui
+from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
studyId = context.studyId
sg = context.sg
- from PyQt5.QtGui import QDialog
- from PyQt5.QtGui import QMessageBox
- from PyQt5.QtCore import Qt
- from PyQt5.QtCore import SIGNAL
+ from PyQt4.QtGui import QDialog
+ from PyQt4.QtGui import QMessageBox
+ from PyQt4.QtCore import Qt
+ from PyQt4.QtCore import SIGNAL
from minmax_dialog import Ui_Dialog
# Author : Guillaume Boulant (EDF)
import sys
-from PyQt5 import QtGui
-from PyQt5 import QtCore
+from PyQt4 import QtGui
+from PyQt4 import QtCore
from tubedialog_ui import TubeDialog_UI
# Author : Guillaume Boulant (EDF)
import sys
-from PyQt5 import QtGui
-from PyQt5 import QtCore
+from PyQt4 import QtGui
+from PyQt4 import QtCore
class TubeDialog_UI(QtGui.QDialog):
import salome_pluginsmanager
def about(context):
- from PyQt5.QtGui import QMessageBox
+ from PyQt4.QtGui import QMessageBox
QMessageBox.about(None, "About SALOME pluginmanager", "SALOME plugins manager in SALOME virtual application ")
salome_pluginsmanager.AddFunction('About plugins','About SALOME pluginmanager',about)
"""
import os,sys,traceback
-from PyQt5 import QtGui
-from PyQt5 import QtCore
+from PyQt4 import QtGui
+from PyQt4 import QtCore
import salome
* - stop Session ( must be idle )
* - get session state
*/
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+void MessageOutput( QtMsgType type, const char* msg )
+#else
void MessageOutput( QtMsgType type, const QMessageLogContext &context, const QString &msg )
+#endif
{
switch ( type )
{
//MESSAGE( "Debug: " << msg );
break;
case QtWarningMsg:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ MESSAGE( "Warning: " << msg );
+#else
MESSAGE( "Warning: " << msg.toLatin1().data() );
+#endif
break;
case QtFatalMsg:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ MESSAGE( "Fatal: " << msg );
+#else
MESSAGE( "Fatal: " << msg.toLatin1().data() );
+#endif
break;
}
}
SALOME_QApplication( int& argc, char** argv ) : TestApplication( argc, argv ), myHandler ( 0 ) {}
#else
SALOME_QApplication( int& argc, char** argv )
-//#ifndef WIN32
+#if !defined WIN32 && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
// san: Opening an X display and choosing a visual most suitable for 3D visualization
// in order to make SALOME viewers work with non-native X servers
-// : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
-//#else
+ : QApplication( (Display*)Qtx::getDisplay(), argc, argv, Qtx::getVisual() ),
+#else
: QApplication( argc, argv ),
-//#endif
+#endif
myHandler ( 0 ) {}
#endif
int main( int argc, char **argv )
{
// Install Qt debug messages handler
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ qInstallMsgHandler( MessageOutput );
+#else
qInstallMessageHandler( MessageOutput );
+#endif
//Set a "native" graphic system in case if application runs on the remote host
QString remote(getenv("REMOTEHOST"));
QString client(getenv("SSH_CLIENT"));
- /*if(remote.length() > 0 || client.length() > 0 ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ if(remote.length() > 0 || client.length() > 0 ) {
QApplication::setGraphicsSystem(QLatin1String("native"));
- }*/
-
+ }
+#endif
// add $QTDIR/plugins to the pluins search path for image plugins
QString qtdir = qgetenv( "QT_ROOT_DIR" );
if ( qtdir.isEmpty() )
#include <QPixmapCache>
#include <limits.h>
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <qdrawutil.h>
+#endif
#define SHADOW 1
#define LINE_GR_MARGIN 10
Use Style_Salome::apply() static function to set SALOME style to the application.
*/
Style_Salome::Style_Salome()
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ : QWindowsStyle()
+#else
: QCommonStyle()
+#endif
{
// initialize SALOME style resources
Q_INIT_RESOURCE( Style );
*/
void Style_Salome::polish ( QApplication* app )
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::polish( app );
+#else
QCommonStyle::polish( app );
+#endif
if ( checkDebugLevel(1) ) {
return;
void Style_Salome::polish ( QWidget* w )
{
if ( checkDebugLevel(2) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::polish( w );
+#else
QCommonStyle::polish( w );
+#endif
return;
}
w->setAttribute( Qt::WA_Hover );
}
- QCommonStyle::polish( w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::polish( w );
+#else
+ QCommonStyle::polish( w );
+#endif
}
/*!
void Style_Salome::unpolish( QWidget* w )
{
if ( checkDebugLevel(3) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::unpolish( w );
+#else
QCommonStyle::unpolish( w );
+#endif
return;
}
w->setAttribute( Qt::WA_Hover, false );
}
- QCommonStyle::unpolish( w );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::unpolish( w );
+#else
+ QCommonStyle::unpolish( w );
+#endif
}
/*!
QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(4) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
return;
}
if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
QStyleOptionSlider tmpSlider = *slider;
tmpSlider.subControls = SC_SliderGroove;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawComplexControl(cc, &tmpSlider, p, w);
+#else
QCommonStyle::drawComplexControl(cc, &tmpSlider, p, w);
+#endif
}
if (slider->subControls & SC_SliderTickmarks) {
QStyleOptionSlider tmpSlider = *slider;
if (w && ( qobject_cast<QToolBar *>(w->parentWidget() ) ||
( toolbutton->state & State_AutoRaise && !( toolbutton->state & State_MouseOver ) ) )
) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
return;
}
int aMinDelta = (int)model()->widgetRounding( Style_Model::ButtonRadius );
}
}
case CC_TitleBar: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
break;
}
case CC_GroupBox:
break;
}
case CC_Dial: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
break;
}
default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawComplexControl( cc, opt, p, w );
+#else
QCommonStyle::drawComplexControl( cc, opt, p, w );
+#endif
}
}
QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(5) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawControl( ce, opt, p, w );
+#else
QCommonStyle::drawControl( ce, opt, p, w );
+#endif
return;
}
break;
}
case CE_Splitter: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawControl( ce, opt, p, w );
+#else
QCommonStyle::drawControl( ce, opt, p, w );
+#endif
QRect r = opt->rect;
bool horiz = r.width() > r.height();
int aLen = model()->splitHandleLength();
aBrdTopCol, aBrdBotCol, isSelected, isLast, isHover );
p->restore();
} else
- QCommonStyle::drawControl(ce, opt, p, w);
+ QCommonStyle::drawControl( ce, opt, p, w );
break;
}
case CE_TabBarTabLabel:
}
QStyleOptionTab* copyTab = (QStyleOptionTab*)tab;
copyTab->rect = oldRect;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawControl( ce, copyTab, p, w );
+#else
QCommonStyle::drawControl( ce, copyTab, p, w );
+#endif
}
else
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawControl( ce, opt, p, w );
+#else
QCommonStyle::drawControl( ce, opt, p, w );
+#endif
break;
}
case CE_MenuBarItem:
break;
}
default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawControl( ce, opt, p, w );
+#else
QCommonStyle::drawControl( ce, opt, p, w );
+#endif
break;
}
}
QPainter* p, const QWidget* w ) const
{
if ( checkDebugLevel(6) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
return;
}
break;
}
else
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
}
break;
case PE_FrameFocusRect: {
aBrdTopCol, aBrdBotCol, false, false, isHover, true );
}
else {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
}
break;
}
break;
}
case PE_Widget: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
if ( !w )
break;
if( w->parent() && !qobject_cast<QMenuBar*>((QWidget*)w) )
= qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
if (tbb->shape != QTabBar::RoundedNorth && tbb->shape != QTabBar::RoundedEast &&
tbb->shape != QTabBar::RoundedSouth && tbb->shape != QTabBar::RoundedWest) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
break;
}
QRect aSelRect = tbb->selectedTabRect;
aPal.setBrush( QPalette::AlternateBase, QBrush( gr_alt ) );
aWdg->setPalette( aPal );
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
break;
}
default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QWindowsStyle::drawPrimitive( pe, opt, p, w );
+#else
QCommonStyle::drawPrimitive( pe, opt, p, w );
+#endif
}
}
const QWidget* w ) const
{
if ( checkDebugLevel(7) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::pixelMetric( metric, opt, w );
+#else
return QCommonStyle::pixelMetric( metric, opt, w );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ int aRes = QWindowsStyle::pixelMetric( metric, opt, w );
+#else
int aRes = QCommonStyle::pixelMetric( metric, opt, w );
+#endif
switch( metric ) {
case PM_SliderLength: {
aRes += (int)((double)model()->sliderSize()/2);
const QSize& contentsSize, const QWidget* w ) const
{
if ( checkDebugLevel(8) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::sizeFromContents( ct, opt,contentsSize, w );
+#else
return QCommonStyle::sizeFromContents( ct, opt,contentsSize, w );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QSize sz = QWindowsStyle::sizeFromContents( ct, opt, contentsSize, w );
+#else
QSize sz = QCommonStyle::sizeFromContents( ct, opt, contentsSize, w );
+#endif
switch (ct) {
case CT_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
QRect res = QRect( 0, 0, sz.width(), sz.height() );
int aHalfRect = (int)Style_Tools::getMaxRect( res,
(int)model()->widgetRounding( Style_Model::EditRadius )/2 ); // left value
- QRect old_arrow = QCommonStyle::subControlRect( CC_ComboBox, cmb,
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QRect old_arrow = QWindowsStyle::subControlRect( CC_ComboBox, cmb,
SC_ComboBoxArrow, w );
+#else
+ QRect old_arrow = QCommonStyle::subControlRect( CC_ComboBox, cmb,
+ SC_ComboBoxArrow, w );
+#endif
int aDelta = res.height() - old_arrow.width(); // right value
if ( cmb->editable )
aDelta += aHalfRect; // for right of line edit internal
const QWidget *w) const
{
if ( checkDebugLevel(9) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+#else
return QCommonStyle::standardPixmap( stPixmap, opt, w );
+#endif
}
switch ( stPixmap )
case SP_TitleBarMinButton:
return QPixmap( minimize_xpm );
default:
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::standardPixmap( stPixmap, opt, w );
+#else
return QCommonStyle::standardPixmap( stPixmap, opt, w );
+#endif
}
}
const QWidget* w ) const
{
if ( checkDebugLevel(10) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
+#else
return QCommonStyle::standardIcon( standardIcon, opt, w );
+#endif
}
switch ( standardIcon )
default:
break;
}
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::standardIconImplementation( standardIcon, opt, w );
+#else
return QCommonStyle::standardIcon( standardIcon, opt, w );
+#endif
}
/*!
QStyleHintReturn* returnData ) const
{
if ( checkDebugLevel(11) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::styleHint( hint, opt, w, returnData );
+#else
return QCommonStyle::styleHint( hint, opt, w, returnData );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ int aRes = QWindowsStyle::styleHint( hint, opt, w, returnData );
+#else
int aRes = QCommonStyle::styleHint( hint, opt, w, returnData );
+#endif
switch( hint ) {
case SH_Table_GridLineColor: {
if ( opt )
SubControl sc, const QWidget* wid ) const
{
if ( checkDebugLevel(12) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::subControlRect( cc, opt, sc, wid );
+#else
return QCommonStyle::subControlRect( cc, opt, sc, wid );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QRect res = QWindowsStyle::subControlRect( cc, opt, sc, wid );
+#else
QRect res = QCommonStyle::subControlRect( cc, opt, sc, wid );
+#endif
switch ( cc ) {
case CC_SpinBox: {
int x = res.x(), w = res.width(), h = res.height();
if ( sc==SC_SpinBoxUp || sc==SC_SpinBoxDown ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QRect frame_r = QWindowsStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+#else
QRect frame_r = QCommonStyle::subControlRect( cc, opt, SC_SpinBoxFrame, wid );
+#endif
h = frame_r.height();
res.setX( x+w-h );
res.setWidth( h );
}
case CC_ScrollBar:
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QRect slider_r = QWindowsStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+#else
QRect slider_r = QCommonStyle::subControlRect( cc, opt, SC_ScrollBarSlider, wid );
+#endif
int aRect = Style_Tools::getMaxRect( slider_r, (int)model()->widgetRounding( Style_Model::ButtonRadius ) );
switch( sc ) {
case SC_ScrollBarSubPage: // between top/left button and slider
const QWidget* wid ) const
{
if ( checkDebugLevel(13) ) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ return QWindowsStyle::subElementRect( se, opt, wid );
+#else
return QCommonStyle::subElementRect( se, opt, wid );
+#endif
}
-
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QRect res = QWindowsStyle::subElementRect( se, opt, wid );
+#else
QRect res = QCommonStyle::subElementRect( se, opt, wid );
+#endif
int aHalfRect = (int)Style_Tools::getMaxRect( res, (int)model()->widgetRounding( Style_Model::EditRadius )/2 );
int w = res.width(), h = res.height();
switch ( se ) {
case SE_ComboBoxFocusRect: {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ QRect old_r = QWindowsStyle::subControlRect( CC_ComboBox,
+ qstyleoption_cast<const QStyleOptionComplex*>( opt ),
+ SC_ComboBoxArrow, wid );
+#else
QRect old_r = QCommonStyle::subControlRect( CC_ComboBox,
qstyleoption_cast<const QStyleOptionComplex*>( opt ),
SC_ComboBoxArrow, wid );
+#endif
int old_w = old_r.width();
res.setWidth( w-h+old_w-2 );
break;
#define STYLE_SALOME_H
#include "Style.h"
-
+#include <QtGlobal>
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QWindowsStyle>
+#else
#include <QCommonStyle>
-
+#endif
class Style_Model;
class QApplication;
class QPainter;
class QtxResourceMgr;
-class STYLE_SALOME_EXPORT Style_Salome : public QCommonStyle
+class STYLE_SALOME_EXPORT Style_Salome
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+: public QWindowsStyle
+#else
+: public QCommonStyle
+#endif
{
Q_OBJECT
#include <vtkRendererCollection.h>
#include <vtkCamera.h>
#ifndef WIN32
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#include <QX11Info>
+#else
#include <QtGui/QX11Info>
+#endif
#include <vtkXOpenGLRenderWindow.h>
//#include <GL/gl.h>
//#include <GL/glu.h>
SET(GenericDialog_FORMS
GenericDialog.ui
)
-
-ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})
+
+IF (NOT SALOME_BUILD_WITH_QT5)
+ SET(_QT_DEFINITIONS ${QT_DEFINITIONS})
+ SET(_QT_LIBRARIES ${QT_LIBRARIES})
+ELSE()
+ SET(_QT_DEFINITIONS ${Qt5Widgets_DEFINITIONS})
+ SET(_QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
+ENDIF()
+
+ADD_DEFINITIONS(${_QT_DEFINITIONS})
ADD_CUSTOM_COMMAND( OUTPUT QDialogTest.cxx QDialogTest.h QDialogTest.ui
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -s -n QDialogTest -t qdialog
${qtester_FORMS_HEADERS}
QDialogTest.cxx
)
-TARGET_LINK_LIBRARIES(qtester ${Qt5Widgets_LIBRARIES})
+
+TARGET_LINK_LIBRARIES(qtester ${_QT_LIBRARIES})
ADD_EXECUTABLE(gtester ${gtester_SOURCES}
${gtester_HEADERS_MOC}
${GenericDialog_FORMS_HEADERS}
GDialogTest.cxx
)
-TARGET_LINK_LIBRARIES(gtester ${Qt5Widgets_LIBRARIES})
+TARGET_LINK_LIBRARIES(gtester ${_QT_LIBRARIES})
INSTALL(TARGETS qtester gtester DESTINATION ${SALOME_INSTALL_BINS})