mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 17:09:39 +00:00
#5480: Drop Qt4 support and require Qt 5.12 or later.
This commit is contained in:
parent
0d70318304
commit
61a5c6125d
31 changed files with 32 additions and 283 deletions
|
@ -13,7 +13,7 @@ Debian:
|
||||||
before_script:
|
before_script:
|
||||||
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
|
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
|
||||||
- apt-get update -yq
|
- apt-get update -yq
|
||||||
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt4-dev libopenal-dev libopenscenegraph-3.4-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev
|
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-iostreams-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt5opengl5-dev libopenal-dev libopenscenegraph-3.4-dev libunshield-dev libtinyxml-dev libmygui-dev libbullet-dev
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- cores_to_use=$((`nproc`-2)); if (( $cores_to_use < 1 )); then cores_to_use=1; fi
|
- cores_to_use=$((`nproc`-2)); if (( $cores_to_use < 1 )); then cores_to_use=1; fi
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
|
Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher
|
||||||
Feature #5362: Show the soul gems' trapped soul in count dialog
|
Feature #5362: Show the soul gems' trapped soul in count dialog
|
||||||
Feature #5445: Handle NiLines
|
Feature #5445: Handle NiLines
|
||||||
|
Task #5480: Drop Qt4 support
|
||||||
|
|
||||||
0.46.0
|
0.46.0
|
||||||
------
|
------
|
||||||
|
|
|
@ -27,7 +27,6 @@ ${ANALYZE} cmake \
|
||||||
-DBUILD_NIFTEST=${BUILD_OPENMW_CS} \
|
-DBUILD_NIFTEST=${BUILD_OPENMW_CS} \
|
||||||
-DBUILD_UNITTESTS=1 \
|
-DBUILD_UNITTESTS=1 \
|
||||||
-DUSE_SYSTEM_TINYXML=1 \
|
-DUSE_SYSTEM_TINYXML=1 \
|
||||||
-DDESIRED_QT_VERSION=5 \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
-DBINDIR=/usr/games \
|
-DBINDIR=/usr/games \
|
||||||
-DCMAKE_BUILD_TYPE="None" \
|
-DCMAKE_BUILD_TYPE="None" \
|
||||||
|
|
|
@ -776,8 +776,7 @@ fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $QT_SDK
|
cd $QT_SDK
|
||||||
add_cmake_opts -DDESIRED_QT_VERSION=5 \
|
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
|
||||||
-DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
|
|
||||||
-DCMAKE_PREFIX_PATH="$QT_SDK"
|
-DCMAKE_PREFIX_PATH="$QT_SDK"
|
||||||
if [ $CONFIGURATION == "Debug" ]; then
|
if [ $CONFIGURATION == "Debug" ]; then
|
||||||
SUFFIX="d"
|
SUFFIX="d"
|
||||||
|
@ -789,8 +788,7 @@ fi
|
||||||
echo Done.
|
echo Done.
|
||||||
else
|
else
|
||||||
QT_SDK="C:/Qt/5.13/msvc2017${SUFFIX}"
|
QT_SDK="C:/Qt/5.13/msvc2017${SUFFIX}"
|
||||||
add_cmake_opts -DDESIRED_QT_VERSION=5 \
|
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
|
||||||
-DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
|
|
||||||
-DCMAKE_PREFIX_PATH="$QT_SDK"
|
-DCMAKE_PREFIX_PATH="$QT_SDK"
|
||||||
if [ $CONFIGURATION == "Debug" ]; then
|
if [ $CONFIGURATION == "Debug" ]; then
|
||||||
SUFFIX="d"
|
SUFFIX="d"
|
||||||
|
|
|
@ -17,7 +17,6 @@ cmake \
|
||||||
-D CMAKE_OSX_SYSROOT="macosx10.14" \
|
-D CMAKE_OSX_SYSROOT="macosx10.14" \
|
||||||
-D CMAKE_BUILD_TYPE=Release \
|
-D CMAKE_BUILD_TYPE=Release \
|
||||||
-D OPENMW_OSX_DEPLOYMENT=TRUE \
|
-D OPENMW_OSX_DEPLOYMENT=TRUE \
|
||||||
-D DESIRED_QT_VERSION=5 \
|
|
||||||
-D BUILD_ESMTOOL=FALSE \
|
-D BUILD_ESMTOOL=FALSE \
|
||||||
-G"Unix Makefiles" \
|
-G"Unix Makefiles" \
|
||||||
..
|
..
|
||||||
|
|
|
@ -19,11 +19,6 @@ else()
|
||||||
set(USE_QT TRUE)
|
set(USE_QT TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_QT)
|
|
||||||
set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)")
|
|
||||||
set_property(CACHE DESIRED_QT_VERSION PROPERTY STRINGS 4 5)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# set the minimum required version across the board
|
# set the minimum required version across the board
|
||||||
cmake_minimum_required(VERSION 3.1.0)
|
cmake_minimum_required(VERSION 3.1.0)
|
||||||
|
|
||||||
|
@ -153,18 +148,12 @@ endif()
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
if (USE_QT)
|
if (USE_QT)
|
||||||
message(STATUS "Using Qt${DESIRED_QT_VERSION}")
|
find_package(Qt5Core 5.12 REQUIRED)
|
||||||
|
find_package(Qt5Widgets REQUIRED)
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
find_package(Qt5Network REQUIRED)
|
||||||
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtOpenGL)
|
find_package(Qt5OpenGL REQUIRED)
|
||||||
else()
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
|
||||||
find_package(Qt5Core REQUIRED)
|
|
||||||
find_package(Qt5Network REQUIRED)
|
|
||||||
find_package(Qt5OpenGL REQUIRED)
|
|
||||||
# Instruct CMake to run moc automatically when needed.
|
# Instruct CMake to run moc automatically when needed.
|
||||||
#set(CMAKE_AUTOMOC ON)
|
#set(CMAKE_AUTOMOC ON)
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Sound setup
|
# Sound setup
|
||||||
|
@ -291,17 +280,6 @@ if(OSG_STATIC)
|
||||||
list(APPEND OPENSCENEGRAPH_LIBRARIES ${OSGPlugins_LIBRARIES})
|
list(APPEND OPENSCENEGRAPH_LIBRARIES ${OSGPlugins_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(QT_STATIC)
|
|
||||||
if(WIN32)
|
|
||||||
if(DESIRED_QT_VERSION MATCHES 4)
|
|
||||||
# QtCore needs WSAAsyncSelect from Ws2_32.lib
|
|
||||||
set(QT_QTCORE_LIBRARY ${QT_QTCORE_LIBRARY} Ws2_32.lib)
|
|
||||||
message("QT_QTCORE_LIBRARY: ${QT_QTCORE_LIBRARY}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
set(BOOST_COMPONENTS system filesystem program_options iostreams)
|
set(BOOST_COMPONENTS system filesystem program_options iostreams)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
|
||||||
|
@ -517,11 +495,6 @@ if(WIN32)
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/Debug/gamecontrollerdb.txt" DESTINATION "." CONFIGURATIONS Debug)
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/Debug/gamecontrollerdb.txt" DESTINATION "." CONFIGURATIONS Debug)
|
||||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/Release/gamecontrollerdb.txt" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
|
INSTALL(FILES "${OpenMW_BINARY_DIR}/Release/gamecontrollerdb.txt" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
|
||||||
|
|
||||||
IF(DESIRED_QT_VERSION MATCHES 5)
|
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Debug/platforms" DESTINATION "." CONFIGURATIONS Debug)
|
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Release/platforms" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Debug/resources" DESTINATION "." CONFIGURATIONS Debug)
|
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Debug/resources" DESTINATION "." CONFIGURATIONS Debug)
|
||||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Release/resources" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
|
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/Release/resources" DESTINATION "." CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel)
|
||||||
|
|
||||||
|
@ -785,7 +758,7 @@ if (WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Apple bundling
|
# Apple bundling
|
||||||
if (OPENMW_OSX_DEPLOYMENT AND APPLE AND DESIRED_QT_VERSION MATCHES 5)
|
if (OPENMW_OSX_DEPLOYMENT AND APPLE)
|
||||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND CMAKE_VERSION VERSION_LESS 3.13.4)
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13 AND CMAKE_VERSION VERSION_LESS 3.13.4)
|
||||||
message(FATAL_ERROR "macOS packaging is broken in early CMake 3.13 releases, see https://gitlab.com/OpenMW/openmw/issues/4767. Please use at least 3.13.4 or an older version like 3.12.4")
|
message(FATAL_ERROR "macOS packaging is broken in early CMake 3.13 releases, see https://gitlab.com/OpenMW/openmw/issues/4767. Please use at least 3.13.4 or an older version like 3.12.4")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -70,16 +70,9 @@ if(WIN32)
|
||||||
set(QT_USE_QTMAIN TRUE)
|
set(QT_USE_QTMAIN TRUE)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
QT5_ADD_RESOURCES(RCC_SRCS ${CMAKE_SOURCE_DIR}/files/launcher/launcher.qrc)
|
||||||
include(${QT_USE_FILE})
|
QT5_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC})
|
||||||
QT4_ADD_RESOURCES(RCC_SRCS ${CMAKE_SOURCE_DIR}/files/launcher/launcher.qrc)
|
QT5_WRAP_UI(UI_HDRS ${LAUNCHER_UI})
|
||||||
QT4_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC})
|
|
||||||
QT4_WRAP_UI(UI_HDRS ${LAUNCHER_UI})
|
|
||||||
else()
|
|
||||||
QT5_ADD_RESOURCES(RCC_SRCS ${CMAKE_SOURCE_DIR}/files/launcher/launcher.qrc)
|
|
||||||
QT5_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC})
|
|
||||||
QT5_WRAP_UI(UI_HDRS ${LAUNCHER_UI})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
|
@ -105,14 +98,7 @@ target_link_libraries(openmw-launcher
|
||||||
components
|
components
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
target_link_libraries(openmw-launcher Qt5::Widgets Qt5::Core)
|
||||||
target_link_libraries(openmw-launcher ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
|
|
||||||
if(WIN32)
|
|
||||||
target_link_libraries(openmw-launcher ${QT_QTMAIN_LIBRARY})
|
|
||||||
endif(WIN32)
|
|
||||||
else()
|
|
||||||
target_link_libraries(openmw-launcher Qt5::Widgets Qt5::Core)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (BUILD_WITH_CODE_COVERAGE)
|
if (BUILD_WITH_CODE_COVERAGE)
|
||||||
add_definitions (--coverage)
|
add_definitions (--coverage)
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
#ifdef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
|
@ -54,13 +51,11 @@ Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, Settings:
|
||||||
|
|
||||||
bool Launcher::GraphicsPage::setupSDL()
|
bool Launcher::GraphicsPage::setupSDL()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
bool sdlConnectSuccessful = initSDL();
|
bool sdlConnectSuccessful = initSDL();
|
||||||
if (!sdlConnectSuccessful)
|
if (!sdlConnectSuccessful)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
int displays = SDL_GetNumVideoDisplays();
|
int displays = SDL_GetNumVideoDisplays();
|
||||||
|
|
||||||
|
@ -81,10 +76,8 @@ bool Launcher::GraphicsPage::setupSDL()
|
||||||
screenComboBox->addItem(QString(tr("Screen ")) + QString::number(i + 1));
|
screenComboBox->addItem(QString(tr("Screen ")) + QString::number(i + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
// Disconnect from SDL processes
|
// Disconnect from SDL processes
|
||||||
quitSDL();
|
quitSDL();
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +316,6 @@ QRect Launcher::GraphicsPage::getMaximumResolution()
|
||||||
{
|
{
|
||||||
QRect max;
|
QRect max;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
for (QScreen* screen : QGuiApplication::screens())
|
for (QScreen* screen : QGuiApplication::screens())
|
||||||
{
|
{
|
||||||
QRect res = screen->geometry();
|
QRect res = screen->geometry();
|
||||||
|
@ -332,17 +324,6 @@ QRect Launcher::GraphicsPage::getMaximumResolution()
|
||||||
if (res.height() > max.height())
|
if (res.height() > max.height())
|
||||||
max.setHeight(res.height());
|
max.setHeight(res.height());
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int screens = QApplication::desktop()->screenCount();
|
|
||||||
for (int i = 0; i < screens; ++i)
|
|
||||||
{
|
|
||||||
QRect res = QApplication::desktop()->screenGeometry(i);
|
|
||||||
if (res.width() > max.width())
|
|
||||||
max.setWidth(res.width());
|
|
||||||
if (res.height() > max.height())
|
|
||||||
max.setHeight(res.height());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,11 @@
|
||||||
#endif // MAC_OS_X_VERSION_MIN_REQUIRED
|
#endif // MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
|
|
||||||
#include "maindialog.hpp"
|
#include "maindialog.hpp"
|
||||||
#include "sdlinit.hpp"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Note: we should init SDL2 before Qt4 to avoid crashes on Linux,
|
|
||||||
// but we should init SDL2 after Qt5 to avoid input issues on MacOS X.
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
||||||
initSDL();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// Internationalization
|
// Internationalization
|
||||||
|
@ -50,11 +43,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
int exitCode = app.exec();
|
int exitCode = app.exec();
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
||||||
// Disconnect from SDL processes
|
|
||||||
quitSDL();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
|
|
|
@ -149,16 +149,9 @@ if(WIN32)
|
||||||
set(QT_USE_QTMAIN TRUE)
|
set(QT_USE_QTMAIN TRUE)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
qt5_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
||||||
include(${QT_USE_FILE})
|
qt5_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
|
||||||
qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
qt5_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
||||||
qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
|
|
||||||
qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
|
||||||
else()
|
|
||||||
qt5_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
|
||||||
qt5_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
|
|
||||||
qt5_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# for compiled .ui files
|
# for compiled .ui files
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
@ -236,19 +229,7 @@ target_link_libraries(openmw-cs
|
||||||
components
|
components
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
target_link_libraries(openmw-cs Qt5::Widgets Qt5::Core Qt5::Network Qt5::OpenGL)
|
||||||
target_link_libraries(openmw-cs
|
|
||||||
${QT_QTGUI_LIBRARY}
|
|
||||||
${QT_QTCORE_LIBRARY}
|
|
||||||
${QT_QTNETWORK_LIBRARY}
|
|
||||||
${QT_QTOPENGL_LIBRARY})
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(openmw-cs ${QT_QTMAIN_LIBRARY})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_link_libraries(openmw-cs Qt5::Widgets Qt5::Core Qt5::Network Qt5::OpenGL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(openmw-cs ${Boost_LOCALE_LIBRARY})
|
target_link_libraries(openmw-cs ${Boost_LOCALE_LIBRARY})
|
||||||
|
|
|
@ -685,7 +685,6 @@ namespace CSMPrefs
|
||||||
std::make_pair((int)Qt::Key_ContrastAdjust , "ContrastAdjust"),
|
std::make_pair((int)Qt::Key_ContrastAdjust , "ContrastAdjust"),
|
||||||
std::make_pair((int)Qt::Key_LaunchG , "LaunchG"),
|
std::make_pair((int)Qt::Key_LaunchG , "LaunchG"),
|
||||||
std::make_pair((int)Qt::Key_LaunchH , "LaunchH"),
|
std::make_pair((int)Qt::Key_LaunchH , "LaunchH"),
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
|
|
||||||
std::make_pair((int)Qt::Key_TouchpadToggle , "TouchpadToggle"),
|
std::make_pair((int)Qt::Key_TouchpadToggle , "TouchpadToggle"),
|
||||||
std::make_pair((int)Qt::Key_TouchpadOn , "TouchpadOn"),
|
std::make_pair((int)Qt::Key_TouchpadOn , "TouchpadOn"),
|
||||||
std::make_pair((int)Qt::Key_TouchpadOff , "TouchpadOff"),
|
std::make_pair((int)Qt::Key_TouchpadOff , "TouchpadOff"),
|
||||||
|
@ -706,7 +705,6 @@ namespace CSMPrefs
|
||||||
std::make_pair((int)Qt::Key_Find , "Find"),
|
std::make_pair((int)Qt::Key_Find , "Find"),
|
||||||
std::make_pair((int)Qt::Key_Undo , "Undo"),
|
std::make_pair((int)Qt::Key_Undo , "Undo"),
|
||||||
std::make_pair((int)Qt::Key_Redo , "Redo"),
|
std::make_pair((int)Qt::Key_Redo , "Redo"),
|
||||||
#endif
|
|
||||||
std::make_pair((int)Qt::Key_AltGr , "AltGr"),
|
std::make_pair((int)Qt::Key_AltGr , "AltGr"),
|
||||||
std::make_pair((int)Qt::Key_Multi_key , "Multi_key"),
|
std::make_pair((int)Qt::Key_Multi_key , "Multi_key"),
|
||||||
std::make_pair((int)Qt::Key_Kanji , "Kanji"),
|
std::make_pair((int)Qt::Key_Kanji , "Kanji"),
|
||||||
|
@ -770,9 +768,7 @@ namespace CSMPrefs
|
||||||
std::make_pair((int)Qt::Key_Sleep , "Sleep"),
|
std::make_pair((int)Qt::Key_Sleep , "Sleep"),
|
||||||
std::make_pair((int)Qt::Key_Play , "Play"),
|
std::make_pair((int)Qt::Key_Play , "Play"),
|
||||||
std::make_pair((int)Qt::Key_Zoom , "Zoom"),
|
std::make_pair((int)Qt::Key_Zoom , "Zoom"),
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
|
|
||||||
std::make_pair((int)Qt::Key_Exit , "Exit"),
|
std::make_pair((int)Qt::Key_Exit , "Exit"),
|
||||||
#endif
|
|
||||||
std::make_pair((int)Qt::Key_Context1 , "Context1"),
|
std::make_pair((int)Qt::Key_Context1 , "Context1"),
|
||||||
std::make_pair((int)Qt::Key_Context2 , "Context2"),
|
std::make_pair((int)Qt::Key_Context2 , "Context2"),
|
||||||
std::make_pair((int)Qt::Key_Context3 , "Context3"),
|
std::make_pair((int)Qt::Key_Context3 , "Context3"),
|
||||||
|
|
|
@ -5,10 +5,7 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "filewidget.hpp"
|
#include "filewidget.hpp"
|
||||||
#include "adjusterwidget.hpp"
|
#include "adjusterwidget.hpp"
|
||||||
|
@ -50,11 +47,7 @@ CSVDoc::NewGameDialogue::NewGameDialogue()
|
||||||
connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)),
|
connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)),
|
||||||
mAdjusterWidget, SLOT (setName (const QString&, bool)));
|
mAdjusterWidget, SLOT (setName (const QString&, bool)));
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
||||||
#else
|
|
||||||
QRect scr = QApplication::desktop()->screenGeometry();
|
|
||||||
#endif
|
|
||||||
QRect rect = geometry();
|
QRect rect = geometry();
|
||||||
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
|
||||||
|
|
||||||
QPushButton *CSVDoc::StartupDialogue::addButton (const QString& label, const QIcon& icon)
|
QPushButton *CSVDoc::StartupDialogue::addButton (const QString& label, const QIcon& icon)
|
||||||
{
|
{
|
||||||
|
@ -123,12 +120,7 @@ CSVDoc::StartupDialogue::StartupDialogue() : mWidth (0), mColumn (2)
|
||||||
|
|
||||||
setLayout (layout);
|
setLayout (layout);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
||||||
#else
|
|
||||||
QRect scr = QApplication::desktop()->screenGeometry();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QRect rect = geometry();
|
QRect rect = geometry();
|
||||||
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
move (scr.center().x() - rect.center().x(), scr.center().y() - rect.center().y());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,7 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../../model/doc/document.hpp"
|
#include "../../model/doc/document.hpp"
|
||||||
#include "../../model/prefs/state.hpp"
|
#include "../../model/prefs/state.hpp"
|
||||||
|
@ -1071,11 +1068,7 @@ void CSVDoc::View::updateWidth(bool isGrowLimit, int minSubViewWidth)
|
||||||
if (isGrowLimit)
|
if (isGrowLimit)
|
||||||
rect = dw->screenGeometry(this);
|
rect = dw->screenGeometry(this);
|
||||||
else
|
else
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
rect = QGuiApplication::screens().at(dw->screenNumber(this))->geometry();
|
rect = QGuiApplication::screens().at(dw->screenNumber(this))->geometry();
|
||||||
#else
|
|
||||||
rect = dw->screenGeometry(dw->screen(dw->screenNumber(this)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!mScrollbarOnly && mScroll && mSubViews.size() > 1)
|
if (!mScrollbarOnly && mScroll && mSubViews.size() > 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#include "dialogue.hpp"
|
#include "dialogue.hpp"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -7,10 +6,7 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QListWidgetItem>
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
|
|
||||||
|
@ -39,11 +35,7 @@ void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main)
|
||||||
{
|
{
|
||||||
QString label = QString::fromUtf8 (iter->second.getKey().c_str());
|
QString label = QString::fromUtf8 (iter->second.getKey().c_str());
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
|
||||||
maxWidth = std::max (maxWidth, metrics.horizontalAdvance (label));
|
maxWidth = std::max (maxWidth, metrics.horizontalAdvance (label));
|
||||||
#else
|
|
||||||
maxWidth = std::max (maxWidth, metrics.width (label));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
list->addItem (label);
|
list->addItem (label);
|
||||||
}
|
}
|
||||||
|
@ -116,11 +108,7 @@ void CSVPrefs::Dialogue::show()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
QRect scr = QGuiApplication::primaryScreen()->geometry();
|
||||||
#else
|
|
||||||
QRect scr = QApplication::desktop()->screenGeometry();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// otherwise place at the centre of the screen
|
// otherwise place at the centre of the screen
|
||||||
QPoint screenCenter = scr.center();
|
QPoint screenCenter = scr.center();
|
||||||
|
|
|
@ -143,14 +143,9 @@ void RenderWidget::toggleRenderStats()
|
||||||
CompositeViewer::CompositeViewer()
|
CompositeViewer::CompositeViewer()
|
||||||
: mSimulationTime(0.0)
|
: mSimulationTime(0.0)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x050000
|
// TODO: Upgrade osgQt to support osgViewer::ViewerBase::DrawThreadPerContext
|
||||||
// Qt5 is currently crashing and reporting "Cannot make QOpenGLContext current in a different thread" when the viewer is run multi-threaded, this is regression from Qt4
|
// https://gitlab.com/OpenMW/openmw/-/issues/5481
|
||||||
osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::SingleThreaded;
|
setThreadingModel(osgViewer::ViewerBase::SingleThreaded);
|
||||||
#else
|
|
||||||
osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::DrawThreadPerContext;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
setThreadingModel(threadingModel);
|
|
||||||
|
|
||||||
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,5)
|
#if OSG_VERSION_GREATER_OR_EQUAL(3,5,5)
|
||||||
setUseConfigureAffinity(false);
|
setUseConfigureAffinity(false);
|
||||||
|
|
|
@ -646,13 +646,8 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
||||||
|
|
||||||
if (mDragging)
|
if (mDragging)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
mDragX = event->localPos().x();
|
mDragX = event->localPos().x();
|
||||||
mDragY = height() - event->localPos().y();
|
mDragY = height() - event->localPos().y();
|
||||||
#else
|
|
||||||
mDragX = event->posF().x();
|
|
||||||
mDragY = height() - event->posF().y();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -144,11 +144,7 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
|
||||||
: CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id)),
|
: CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id)),
|
||||||
mRefreshAction (0), mRefreshState (refreshState)
|
mRefreshAction (0), mRefreshState (refreshState)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
||||||
#else
|
|
||||||
horizontalHeader()->setResizeMode (QHeaderView::Interactive);
|
|
||||||
#endif
|
|
||||||
horizontalHeader()->setStretchLastSection (true);
|
horizontalHeader()->setStretchLastSection (true);
|
||||||
verticalHeader()->hide();
|
verticalHeader()->hide();
|
||||||
setSortingEnabled (true);
|
setSortingEnabled (true);
|
||||||
|
|
|
@ -5,10 +5,7 @@
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "colorpickerpopup.hpp"
|
#include "colorpickerpopup.hpp"
|
||||||
|
|
||||||
|
@ -99,11 +96,7 @@ QPoint CSVWidget::ColorEditor::calculatePopupPosition()
|
||||||
{
|
{
|
||||||
QRect editorGeometry = geometry();
|
QRect editorGeometry = geometry();
|
||||||
QRect popupGeometry = mColorPicker->geometry();
|
QRect popupGeometry = mColorPicker->geometry();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
|
QRect screenGeometry = QGuiApplication::primaryScreen()->geometry();
|
||||||
#else
|
|
||||||
QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Center the popup horizontally relative to the editor
|
// Center the popup horizontally relative to the editor
|
||||||
int localPopupX = (editorGeometry.width() - popupGeometry.width()) / 2;
|
int localPopupX = (editorGeometry.width() - popupGeometry.width()) / 2;
|
||||||
|
|
|
@ -64,13 +64,8 @@ CSVWidget::SceneToolRun::SceneToolRun (SceneToolbar *parent, const QString& tool
|
||||||
mTable->setShowGrid (false);
|
mTable->setShowGrid (false);
|
||||||
mTable->verticalHeader()->hide();
|
mTable->verticalHeader()->hide();
|
||||||
mTable->horizontalHeader()->hide();
|
mTable->horizontalHeader()->hide();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
mTable->horizontalHeader()->setSectionResizeMode (0, QHeaderView::Stretch);
|
mTable->horizontalHeader()->setSectionResizeMode (0, QHeaderView::Stretch);
|
||||||
mTable->horizontalHeader()->setSectionResizeMode (1, QHeaderView::ResizeToContents);
|
mTable->horizontalHeader()->setSectionResizeMode (1, QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
mTable->horizontalHeader()->setResizeMode (0, QHeaderView::Stretch);
|
|
||||||
mTable->horizontalHeader()->setResizeMode (1, QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
mTable->setSelectionMode (QAbstractItemView::NoSelection);
|
mTable->setSelectionMode (QAbstractItemView::NoSelection);
|
||||||
|
|
||||||
layout->addWidget (mTable);
|
layout->addWidget (mTable);
|
||||||
|
|
|
@ -180,13 +180,8 @@ CSVWidget::SceneToolShapeBrush::SceneToolShapeBrush (SceneToolbar *parent, const
|
||||||
mTable->setShowGrid (true);
|
mTable->setShowGrid (true);
|
||||||
mTable->verticalHeader()->hide();
|
mTable->verticalHeader()->hide();
|
||||||
mTable->horizontalHeader()->hide();
|
mTable->horizontalHeader()->hide();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
mTable->horizontalHeader()->setSectionResizeMode (0, QHeaderView::Stretch);
|
mTable->horizontalHeader()->setSectionResizeMode (0, QHeaderView::Stretch);
|
||||||
mTable->horizontalHeader()->setSectionResizeMode (1, QHeaderView::Stretch);
|
mTable->horizontalHeader()->setSectionResizeMode (1, QHeaderView::Stretch);
|
||||||
#else
|
|
||||||
mTable->horizontalHeader()->setResizeMode (0, QHeaderView::Stretch);
|
|
||||||
mTable->horizontalHeader()->setResizeMode (1, QHeaderView::Stretch);
|
|
||||||
#endif
|
|
||||||
mTable->setSelectionMode (QAbstractItemView::NoSelection);
|
mTable->setSelectionMode (QAbstractItemView::NoSelection);
|
||||||
|
|
||||||
layout->addWidget (mTable);
|
layout->addWidget (mTable);
|
||||||
|
|
|
@ -243,13 +243,8 @@ CSVWidget::SceneToolTextureBrush::SceneToolTextureBrush (SceneToolbar *parent, c
|
||||||
mTable->setShowGrid (true);
|
mTable->setShowGrid (true);
|
||||||
mTable->verticalHeader()->hide();
|
mTable->verticalHeader()->hide();
|
||||||
mTable->horizontalHeader()->hide();
|
mTable->horizontalHeader()->hide();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
mTable->horizontalHeader()->setSectionResizeMode (0, QHeaderView::Stretch);
|
mTable->horizontalHeader()->setSectionResizeMode (0, QHeaderView::Stretch);
|
||||||
mTable->horizontalHeader()->setSectionResizeMode (1, QHeaderView::Stretch);
|
mTable->horizontalHeader()->setSectionResizeMode (1, QHeaderView::Stretch);
|
||||||
#else
|
|
||||||
mTable->horizontalHeader()->setResizeMode (0, QHeaderView::Stretch);
|
|
||||||
mTable->horizontalHeader()->setResizeMode (1, QHeaderView::Stretch);
|
|
||||||
#endif
|
|
||||||
mTable->setSelectionMode (QAbstractItemView::NoSelection);
|
mTable->setSelectionMode (QAbstractItemView::NoSelection);
|
||||||
|
|
||||||
layout->addWidget (mTable);
|
layout->addWidget (mTable);
|
||||||
|
|
|
@ -108,13 +108,8 @@ void CSVWorld::EnumDelegate::paint (QPainter *painter, const QStyleOptionViewIte
|
||||||
const QModelIndex& index) const
|
const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
int valueIndex = getValueIndex(index);
|
int valueIndex = getValueIndex(index);
|
||||||
if (valueIndex != -1)
|
if (valueIndex != -
|
||||||
{
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,7,0)
|
|
||||||
QStyleOptionViewItem itemOption(option);
|
QStyleOptionViewItem itemOption(option);
|
||||||
#else
|
|
||||||
QStyleOptionViewItemV4 itemOption(option);
|
|
||||||
#endif
|
|
||||||
itemOption.text = mValues.at(valueIndex).second;
|
itemOption.text = mValues.at(valueIndex).second;
|
||||||
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &itemOption, painter);
|
QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &itemOption, painter);
|
||||||
}
|
}
|
||||||
|
@ -134,13 +129,7 @@ QSize CSVWorld::EnumDelegate::sizeHint(const QStyleOptionViewItem &option, const
|
||||||
itemOption.state = option.state;
|
itemOption.state = option.state;
|
||||||
|
|
||||||
const QString &valueText = mValues.at(valueIndex).second;
|
const QString &valueText = mValues.at(valueIndex).second;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
|
||||||
QSize valueSize = QSize(itemOption.fontMetrics.horizontalAdvance(valueText), itemOption.fontMetrics.height());
|
QSize valueSize = QSize(itemOption.fontMetrics.horizontalAdvance(valueText), itemOption.fontMetrics.height());
|
||||||
#else
|
|
||||||
QSize valueSize = QSize(itemOption.fontMetrics.width(valueText), itemOption.fontMetrics.height());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
itemOption.currentText = valueText;
|
itemOption.currentText = valueText;
|
||||||
return QApplication::style()->sizeFromContents(QStyle::CT_ComboBox, &itemOption, valueSize);
|
return QApplication::style()->sizeFromContents(QStyle::CT_ComboBox, &itemOption, valueSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,7 @@ CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document,
|
||||||
setSelectionBehavior (QAbstractItemView::SelectRows);
|
setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
||||||
#else
|
|
||||||
horizontalHeader()->setResizeMode (QHeaderView::Interactive);
|
|
||||||
#endif
|
|
||||||
verticalHeader()->hide();
|
verticalHeader()->hide();
|
||||||
|
|
||||||
int columns = model->columnCount(QModelIndex());
|
int columns = model->columnCount(QModelIndex());
|
||||||
|
|
|
@ -205,12 +205,7 @@ bool CSVWorld::ScriptEdit::stringNeedsQuote (const std::string& id) const
|
||||||
void CSVWorld::ScriptEdit::setTabWidth()
|
void CSVWorld::ScriptEdit::setTabWidth()
|
||||||
{
|
{
|
||||||
// Set tab width to specified number of characters using current font.
|
// Set tab width to specified number of characters using current font.
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
|
||||||
setTabStopDistance(mTabCharCount * fontMetrics().horizontalAdvance(' '));
|
setTabStopDistance(mTabCharCount * fontMetrics().horizontalAdvance(' '));
|
||||||
#else
|
|
||||||
setTabStopWidth(mTabCharCount * fontMetrics().width(' '));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::ScriptEdit::wrapLines(bool wrap)
|
void CSVWorld::ScriptEdit::wrapLines(bool wrap)
|
||||||
|
@ -290,12 +285,7 @@ int CSVWorld::ScriptEdit::lineNumberAreaWidth()
|
||||||
++digits;
|
++digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
|
|
||||||
int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits;
|
int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits;
|
||||||
#else
|
|
||||||
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,13 +83,8 @@ CSVWorld::ScriptErrorTable::ScriptErrorTable (const CSMDoc::Document& document,
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
headers << "Severity" << "Line" << "Description";
|
headers << "Severity" << "Line" << "Description";
|
||||||
setHorizontalHeaderLabels (headers);
|
setHorizontalHeaderLabels (headers);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
horizontalHeader()->setSectionResizeMode (0, QHeaderView::ResizeToContents);
|
horizontalHeader()->setSectionResizeMode (0, QHeaderView::ResizeToContents);
|
||||||
horizontalHeader()->setSectionResizeMode (1, QHeaderView::ResizeToContents);
|
horizontalHeader()->setSectionResizeMode (1, QHeaderView::ResizeToContents);
|
||||||
#else
|
|
||||||
horizontalHeader()->setResizeMode (0, QHeaderView::ResizeToContents);
|
|
||||||
horizontalHeader()->setResizeMode (1, QHeaderView::ResizeToContents);
|
|
||||||
#endif
|
|
||||||
horizontalHeader()->setStretchLastSection (true);
|
horizontalHeader()->setStretchLastSection (true);
|
||||||
verticalHeader()->hide();
|
verticalHeader()->hide();
|
||||||
setColumnHidden (3, true);
|
setColumnHidden (3, true);
|
||||||
|
|
|
@ -262,11 +262,7 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
||||||
mDispatcher = new CSMWorld::CommandDispatcher (document, id, this);
|
mDispatcher = new CSMWorld::CommandDispatcher (document, id, this);
|
||||||
|
|
||||||
setModel (mProxyModel);
|
setModel (mProxyModel);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
||||||
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
||||||
#else
|
|
||||||
horizontalHeader()->setResizeMode (QHeaderView::Interactive);
|
|
||||||
#endif
|
|
||||||
verticalHeader()->hide();
|
verticalHeader()->hide();
|
||||||
setSelectionBehavior (QAbstractItemView::SelectRows);
|
setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||||
|
|
|
@ -79,16 +79,9 @@ if(WIN32)
|
||||||
set(QT_USE_QTMAIN TRUE)
|
set(QT_USE_QTMAIN TRUE)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
QT5_ADD_RESOURCES(RCC_SRCS ${CMAKE_SOURCE_DIR}/files/wizard/wizard.qrc)
|
||||||
include(${QT_USE_FILE})
|
QT5_WRAP_CPP(MOC_SRCS ${WIZARD_HEADER_MOC})
|
||||||
QT4_ADD_RESOURCES(RCC_SRCS ${CMAKE_SOURCE_DIR}/files/wizard/wizard.qrc)
|
QT5_WRAP_UI(UI_HDRS ${WIZARD_UI})
|
||||||
QT4_WRAP_CPP(MOC_SRCS ${WIZARD_HEADER_MOC})
|
|
||||||
QT4_WRAP_UI(UI_HDRS ${WIZARD_UI})
|
|
||||||
else()
|
|
||||||
QT5_ADD_RESOURCES(RCC_SRCS ${CMAKE_SOURCE_DIR}/files/wizard/wizard.qrc)
|
|
||||||
QT5_WRAP_CPP(MOC_SRCS ${WIZARD_HEADER_MOC})
|
|
||||||
QT5_WRAP_UI(UI_HDRS ${WIZARD_UI})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
@ -109,23 +102,12 @@ target_link_libraries(openmw-wizard
|
||||||
components
|
components
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
target_link_libraries(openmw-wizard Qt5::Widgets Qt5::Core)
|
||||||
target_link_libraries(openmw-wizard
|
|
||||||
${QT_QTGUI_LIBRARY}
|
|
||||||
${QT_QTCORE_LIBRARY})
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(openmw-wizard ${QT_QTMAIN_LIBRARY})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
target_link_libraries(openmw-wizard Qt5::Widgets Qt5::Core)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (OPENMW_USE_UNSHIELD)
|
if (OPENMW_USE_UNSHIELD)
|
||||||
target_link_libraries(openmw-wizard ${LIBUNSHIELD_LIBRARIES})
|
target_link_libraries(openmw-wizard ${LIBUNSHIELD_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(DPKG_PROGRAM)
|
if(DPKG_PROGRAM)
|
||||||
INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION games COMPONENT openmw-wizard)
|
INSTALL(TARGETS openmw-wizard RUNTIME DESTINATION games COMPONENT openmw-wizard)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -200,14 +200,8 @@ if (USE_QT)
|
||||||
helpviewer
|
helpviewer
|
||||||
)
|
)
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
QT5_WRAP_UI(ESM_UI_HDR ${ESM_UI})
|
||||||
include(${QT_USE_FILE})
|
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
|
||||||
QT4_WRAP_UI(ESM_UI_HDR ${ESM_UI})
|
|
||||||
QT4_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
|
|
||||||
else()
|
|
||||||
QT5_WRAP_UI(ESM_UI_HDR ${ESM_UI})
|
|
||||||
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
@ -252,13 +246,7 @@ if (WIN32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (USE_QT)
|
if (USE_QT)
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
target_link_libraries(components Qt5::Widgets Qt5::Core)
|
||||||
target_link_libraries(components
|
|
||||||
${QT_QTCORE_LIBRARY}
|
|
||||||
${QT_QTGUI_LIBRARY})
|
|
||||||
else()
|
|
||||||
target_link_libraries(components Qt5::Widgets Qt5::Core)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GIT_CHECKOUT)
|
if (GIT_CHECKOUT)
|
||||||
|
|
7
extern/osgQt/CMakeLists.txt
vendored
7
extern/osgQt/CMakeLists.txt
vendored
|
@ -8,12 +8,7 @@ set(OSGQT_SOURCE_FILES
|
||||||
|
|
||||||
add_library(${OSGQT_LIBRARY} STATIC ${OSGQT_SOURCE_FILES})
|
add_library(${OSGQT_LIBRARY} STATIC ${OSGQT_SOURCE_FILES})
|
||||||
|
|
||||||
if (DESIRED_QT_VERSION MATCHES 4)
|
target_link_libraries(${OSGQT_LIBRARY} Qt5::Core Qt5::OpenGL)
|
||||||
include(${QT_USE_FILE})
|
|
||||||
target_link_libraries(${OSGQT_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTOPENGL_LIBRARY})
|
|
||||||
else()
|
|
||||||
target_link_libraries(${OSGQT_LIBRARY} Qt5::Core Qt5::OpenGL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
link_directories(${CMAKE_CURRENT_BINARY_DIR})
|
link_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
|
20
extern/osgQt/GraphicsWindowQt.cpp
vendored
20
extern/osgQt/GraphicsWindowQt.cpp
vendored
|
@ -17,18 +17,11 @@
|
||||||
#include <osgViewer/ViewerBase>
|
#include <osgViewer/ViewerBase>
|
||||||
#include <QInputEvent>
|
#include <QInputEvent>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace osgQt;
|
using namespace osgQt;
|
||||||
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 2, 0))
|
#define GETDEVICEPIXELRATIO() devicePixelRatio()
|
||||||
#define GETDEVICEPIXELRATIO() 1.0
|
|
||||||
#else
|
|
||||||
#define GETDEVICEPIXELRATIO() devicePixelRatio()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GLWidget::GLWidget( QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f)
|
GLWidget::GLWidget( QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f)
|
||||||
: QGLWidget(parent, shareWidget, f), _gw( NULL )
|
: QGLWidget(parent, shareWidget, f), _gw( NULL )
|
||||||
|
@ -119,13 +112,11 @@ bool GLWidget::event( QEvent* event )
|
||||||
enqueueDeferredEvent(QEvent::ParentChange);
|
enqueueDeferredEvent(QEvent::ParentChange);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
|
||||||
else if (event->type() == QEvent::PlatformSurface && static_cast<QPlatformSurfaceEvent*>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed)
|
else if (event->type() == QEvent::PlatformSurface && static_cast<QPlatformSurfaceEvent*>(event)->surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed)
|
||||||
{
|
{
|
||||||
if (_gw)
|
if (_gw)
|
||||||
_gw->close();
|
_gw->close();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// perform regular event handling
|
// perform regular event handling
|
||||||
return QGLWidget::event( event );
|
return QGLWidget::event( event );
|
||||||
|
@ -209,11 +200,7 @@ bool GraphicsWindowQt::init( QWidget* parent, const QGLWidget* shareWidget, Qt::
|
||||||
// WindowFlags
|
// WindowFlags
|
||||||
Qt::WindowFlags flags = f | Qt::Window | Qt::CustomizeWindowHint;
|
Qt::WindowFlags flags = f | Qt::Window | Qt::CustomizeWindowHint;
|
||||||
if ( _traits->windowDecoration )
|
if ( _traits->windowDecoration )
|
||||||
flags |= Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint
|
flags |= Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
|
||||||
#if (QT_VERSION_CHECK(4, 5, 0) <= QT_VERSION)
|
|
||||||
| Qt::WindowCloseButtonHint
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
// create widget
|
// create widget
|
||||||
_widget = new GLWidget( traits2qglFormat( _traits.get() ), parent, shareWidget, flags );
|
_widget = new GLWidget( traits2qglFormat( _traits.get() ), parent, shareWidget, flags );
|
||||||
|
@ -527,11 +514,10 @@ bool GraphicsWindowQt::releaseContextImplementation()
|
||||||
|
|
||||||
void GraphicsWindowQt::swapBuffersImplementation()
|
void GraphicsWindowQt::swapBuffersImplementation()
|
||||||
{
|
{
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
||||||
// QOpenGLContext complains if we swap on an non-exposed QWindow
|
// QOpenGLContext complains if we swap on an non-exposed QWindow
|
||||||
if (!_widget || !_widget->windowHandle()->isExposed())
|
if (!_widget || !_widget->windowHandle()->isExposed())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
// FIXME: the processDeferredEvents should really be executed in a GUI (main) thread context but
|
// FIXME: the processDeferredEvents should really be executed in a GUI (main) thread context but
|
||||||
// I couln't find any reliable way to do this. For now, lets hope non of *GUI thread only operations* will
|
// I couln't find any reliable way to do this. For now, lets hope non of *GUI thread only operations* will
|
||||||
// be executed in a QGLWidget::event handler. On the other hand, calling GUI only operations in the
|
// be executed in a QGLWidget::event handler. On the other hand, calling GUI only operations in the
|
||||||
|
|
Loading…
Reference in a new issue