Permalink
Browse files

Drop Qt4 support

This commit removes all code and configuration that was required for
building with Qt4. Hopefully noone really needs it anymore.

See issue #603.
  • Loading branch information...
1 parent 1ced897 commit b9e4433318efb869af494dd2c7631e0787248143 @MKleusberg MKleusberg committed Oct 18, 2016
View
@@ -40,11 +40,11 @@ script:
- mkdir build
- mkdir build_cipher
- cd build
- - cmake -DENABLE_TESTING=ON -DUSE_QT5=1 ..
+ - cmake -DENABLE_TESTING=ON ..
- make
- ctest -V
- cd ../build_cipher
- - cmake -DENABLE_TESTING=ON -Dsqlcipher=1 -DUSE_QT5=1 ..
+ - cmake -DENABLE_TESTING=ON -Dsqlcipher=1 ..
- make
- ctest -V
View
@@ -38,7 +38,7 @@ $ git clone https://github.com/sqlitebrowser/sqlitebrowser.git
$ cd sqlitebrowser
$ mkdir build
$ cd build
-$ cmake -DUSE_QT5=ON -Wno-dev ..
+$ cmake -Wno-dev ..
$ make
$ sudo make install
```
View
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 2.8.7)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
-OPTION(USE_QT5 "Build with qt5" OFF)
OPTION(ENABLE_TESTING "Enable the unit tests" OFF)
if(NOT CMAKE_BUILD_TYPE)
@@ -42,7 +41,6 @@ if(WIN32 AND MSVC)
endif()
endif()
set(CMAKE_PREFIX_PATH "${QT5_PATH};${SQLITE3_PATH}")
- set(USE_QT5 TRUE)
set(VSREDIST_DIR "C:/dev/dependencies")
endif()
@@ -60,16 +58,10 @@ add_subdirectory(${QHEXEDIT_DIR})
add_subdirectory(${QCUSTOMPLOT_DIR})
add_subdirectory(${QSCINTILLA_DIR})
-if(USE_QT5)
- find_package(Qt5Widgets REQUIRED)
- find_package(Qt5LinguistTools REQUIRED)
- set(CMAKE_AUTOMOC ON)
- set(CMAKE_INCLUDE_CURRENT_DIR ON)
-else()
- find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
- include("${QT_USE_FILE}")
- add_definitions(${QT_DEFINITIONS})
-endif()
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5LinguistTools REQUIRED)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(ENABLE_TESTING)
enable_testing()
@@ -185,28 +177,16 @@ set(SQLB_TSS
"${CMAKE_SOURCE_DIR}/src/translations/sqlb_tr.ts"
)
-if(USE_QT5)
- qt5_wrap_ui(SQLB_FORM_HDR ${SQLB_FORMS})
- if(SQLB_TSS)
- # add translations
- foreach(SQLB_TS ${SQLB_TSS})
- SET_SOURCE_FILES_PROPERTIES("${SQLB_TS}" PROPERTIES OUTPUT_LOCATION "${CMAKE_SOURCE_DIR}/src/translations")
- endforeach(SQLB_TS ${SQLB_TSS})
- qt5_add_translation(SQLB_QMS ${SQLB_TSS})
- endif(SQLB_TSS)
- qt5_add_resources(SQLB_RESOURCES_RCC ${SQLB_RESOURCES})
-else()
- QT4_WRAP_CPP(SQLB_MOC ${SQLB_MOC_HDR})
- QT4_WRAP_UI(SQLB_FORM_HDR ${SQLB_FORMS})
- if(SQLB_TSS)
- # add translations
- foreach(SQLB_TS ${SQLB_TSS})
- SET_SOURCE_FILES_PROPERTIES("${SQLB_TS}" PROPERTIES OUTPUT_LOCATION "${CMAKE_SOURCE_DIR}/src/translations")
- endforeach(SQLB_TS ${SQLB_TSS})
- QT4_ADD_TRANSLATION(SQLB_QMS ${SQLB_TSS})
- endif(SQLB_TSS)
- QT4_ADD_RESOURCES(SQLB_RESOURCES_RCC ${SQLB_RESOURCES})
-endif()
+
+qt5_wrap_ui(SQLB_FORM_HDR ${SQLB_FORMS})
+if(SQLB_TSS)
+ # add translations
+ foreach(SQLB_TS ${SQLB_TSS})
+ SET_SOURCE_FILES_PROPERTIES("${SQLB_TS}" PROPERTIES OUTPUT_LOCATION "${CMAKE_SOURCE_DIR}/src/translations")
+ endforeach(SQLB_TS ${SQLB_TSS})
+ qt5_add_translation(SQLB_QMS ${SQLB_TSS})
+endif(SQLB_TSS)
+qt5_add_resources(SQLB_RESOURCES_RCC ${SQLB_RESOURCES})
#icon and correct libs/subsystem for windows
if(WIN32)
@@ -279,10 +259,9 @@ add_executable(${PROJECT_NAME}
${SQLB_RESOURCES_RCC}
${SQLB_MISC})
-if(USE_QT5)
- qt5_use_modules(${PROJECT_NAME} Gui Widgets Network Test PrintSupport)
- set(QT_LIBRARIES "")
-endif()
+qt5_use_modules(${PROJECT_NAME} Gui Widgets Network Test PrintSupport)
+set(QT_LIBRARIES "")
+
add_dependencies(${PROJECT_NAME} qhexedit qcustomplot qscintilla2)
if(NOT ANTLR2_FOUND)
add_dependencies(${PROJECT_NAME} antlr)
@@ -321,9 +300,9 @@ if(WIN32 AND MSVC)
endif()
if(NOT WIN32)
-install(TARGETS ${PROJECT_NAME}
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib)
+ install(TARGETS ${PROJECT_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib)
endif()
if(ENABLE_TESTING)
@@ -1,16 +1,10 @@
cmake_minimum_required(VERSION 2.8.7)
-if(USE_QT5)
- set(CMAKE_AUTOMOC ON)
- set(CMAKE_INCLUDE_CURRENT_DIR ON)
- find_package(Qt5Widgets REQUIRED)
-else()
- find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
- include("${QT_USE_FILE}")
- add_definitions(${QT_DEFINITIONS})
-endif()
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+find_package(Qt5Widgets REQUIRED)
-if(APPLE AND USE_QT5)
+if(APPLE)
find_package(Qt5MacExtras)
endif()
@@ -149,18 +143,12 @@ set(QSCINTILLA_MOC_HDR
ScintillaQt.h
)
-if(NOT USE_QT5)
- QT4_WRAP_CPP(QSCINTILLA_MOC ${QSCINTILLA_MOC_HDR})
-endif()
-
include_directories(. ../include ../lexlib ../src)
add_library(qscintilla2 ${QSCINTILLA_SRC} ${QSCINTILLA_HDR} ${QSCINTILLA_MOC_HDR} ${QSCINTILLA_MOC})
-if(USE_QT5)
- if (APPLE)
- qt5_use_modules(qscintilla2 Widgets PrintSupport MacExtras)
- else()
- qt5_use_modules(qscintilla2 Widgets PrintSupport)
- endif()
+if (APPLE)
+ qt5_use_modules(qscintilla2 Widgets PrintSupport MacExtras)
+else()
+ qt5_use_modules(qscintilla2 Widgets PrintSupport)
endif()
View
@@ -19,10 +19,6 @@ Application::Application(int& argc, char** argv) :
// Set character encoding to UTF8
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
-#if QT_VERSION < 0x050000
- QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
- QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
-#endif
// Load translations
bool ok;
@@ -42,23 +42,16 @@ ColumnDisplayFormatDialog::~ColumnDisplayFormatDialog()
QString ColumnDisplayFormatDialog::selectedDisplayFormat() const
{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
if(ui->comboDisplayFormat->currentData().toString() == "default")
-#else
- if(ui->comboDisplayFormat->itemData(ui->comboDisplayFormat->currentIndex()).toString() == "default")
-#endif
return QString();
else
return ui->editDisplayFormat->text();
}
void ColumnDisplayFormatDialog::updateSqlCode()
{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
QString format = ui->comboDisplayFormat->currentData().toString();
-#else
- QString format = ui->comboDisplayFormat->itemData(ui->comboDisplayFormat->currentIndex()).toString();
-#endif
+
if(format == "default")
ui->editDisplayFormat->setText(sqlb::escapeIdentifier(column_name));
else if(format == "lower")
@@ -22,12 +22,7 @@ CreateIndexDialog::CreateIndexDialog(DBBrowserDB* db, QWidget* parent)
ui->comboTableName->addItem(QIcon(QString(":icons/table")), (*it).getname());
QHeaderView *tableHeaderView = ui->tableIndexColumns->horizontalHeader();
-
-#if QT_VERSION < 0x050000
- tableHeaderView->setResizeMode(0, QHeaderView::Stretch);
-#else
tableHeaderView->setSectionResizeMode(0, QHeaderView::Stretch);
-#endif
}
CreateIndexDialog::~CreateIndexDialog()
@@ -277,11 +277,7 @@ void EditTableDialog::itemChanged(QTreeWidgetItem *item, int column)
if(item->checkState(column) == Qt::Checked)
pk.push_back(field);
else
-#if QT_VERSION_MAJOR >= 5
pk.removeAll(field);
-#else
- pk.remove(pk.indexOf(field));
-#endif
if(item->checkState(column) == Qt::Checked)
{
@@ -9,11 +9,9 @@
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
-#if QT_VERSION_MAJOR >= 5
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
-#endif
ExportDataDialog::ExportDataDialog(DBBrowserDB* db, ExportFormats format, QWidget* parent, const QString& query, const QString& selection)
: QDialog(parent),
@@ -173,9 +171,6 @@ bool ExportDataDialog::exportQueryCsv(const QString& sQuery, const QString& sFil
bool ExportDataDialog::exportQueryJson(const QString& sQuery, const QString& sFilename)
{
-#if QT_VERSION_MAJOR < 5
- return false;
-#else
// Open file
QFile file(sFilename);
if(file.open(QIODevice::WriteOnly))
@@ -236,7 +231,6 @@ bool ExportDataDialog::exportQueryJson(const QString& sQuery, const QString& sFi
}
return true;
-#endif
}
void ExportDataDialog::accept()
@@ -7,9 +7,7 @@
FilterLineEdit::FilterLineEdit(QWidget* parent, QList<FilterLineEdit*>* filters, int columnnum) : QLineEdit(parent), filterList(filters), columnNumber(columnnum)
{
setPlaceholderText(tr("Filter"));
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
setClearButtonEnabled(true);
-#endif
setProperty("column", columnnum); // Store the column number for later use
// Introduce a timer for delaying the signal triggered whenever the user changes the filter value.
@@ -9,12 +9,7 @@ FilterTableHeader::FilterTableHeader(QTableView* parent) :
QHeaderView(Qt::Horizontal, parent)
{
// Activate the click signals to allow sorting
-#if QT_VERSION >= 0x050000
setSectionsClickable(true);
-#else
- setClickable(true);
-#endif
-
setSortIndicatorShown(true);
// Do some connects: Basically just resize and reposition the input widgets whenever anything changes
View
@@ -157,13 +157,6 @@ class Field
typedef QMultiMap<FieldVector, ConstraintPtr> ConstraintMap;
-#if QT_VERSION_MAJOR < 5
-inline bool operator<(const FieldVector&, const FieldVector&)
-{
- return false;
-}
-#endif
-
class Table
{
public:
View
@@ -1,7 +1,6 @@
TEMPLATE = app
-QT += core gui network
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
+QT += core gui network widgets printsupport
TARGET = sqlitebrowser
@@ -13,11 +12,7 @@ QMAKE_CXXFLAGS += -std=c++11
# create a unittest option
CONFIG(unittest) {
- greaterThan(QT_MAJOR_VERSION, 4) {
- QT += testlib
- } else {
- CONFIG += qtestlib
- }
+ QT += testlib
HEADERS += tests/testsqlobjects.h tests/TestImport.h
SOURCES += tests/testsqlobjects.cpp tests/TestImport.cpp tests/TestMain.cpp
@@ -1,9 +1,3 @@
-if(NOT USE_QT5)
- find_package(Qt4 COMPONENTS QtTest REQUIRED)
- include("${QT_USE_FILE}")
- add_definitions(${QT_DEFINITIONS})
-endif()
-
include_directories("${CMAKE_CURRENT_BINARY_DIR}" ..)
# test-sqlobjects
@@ -51,19 +45,12 @@ if(sqlcipher)
list(APPEND TESTSQLOBJECTS_MOC_HDR ../CipherDialog.h)
endif()
-if(USE_QT5)
- QT5_WRAP_UI(TESTSQLOBJECTS_FORM_HDR ${TESTSQLOBJECTS_FORMS})
-else()
- QT4_WRAP_CPP(TESTSQLOBJECTS_MOC ${TESTSQLOBJECTS_MOC_HDR})
- QT4_WRAP_UI(TESTSQLOBJECTS_FORM_HDR ${TESTSQLOBJECTS_FORMS})
-endif()
+QT5_WRAP_UI(TESTSQLOBJECTS_FORM_HDR ${TESTSQLOBJECTS_FORMS})
add_executable(test-sqlobjects ${TESTSQLOBJECTS_MOC} ${TESTSQLOBJECTS_HDR} ${TESTSQLOBJECTS_SRC} ${TESTSQLOBJECTS_FORM_HDR})
-if(USE_QT5)
- qt5_use_modules(test-sqlobjects Test Widgets Gui)
- set(QT_LIBRARIES "")
-endif()
+qt5_use_modules(test-sqlobjects Test Widgets Gui)
+set(QT_LIBRARIES "")
if(NOT ANTLR2_FOUND)
add_dependencies(test-sqlobjects antlr)
@@ -90,16 +77,10 @@ set(TESTIMPORT_MOC_HDR
TestImport.h
)
-if(NOT USE_QT5)
- QT4_WRAP_CPP(TESTIMPORT_MOC ${TESTIMPORT_MOC_HDR})
-endif()
-
add_executable(test-import ${TESTIMPORT_MOC} ${TESTIMPORT_SRC})
-if(USE_QT5)
- qt5_use_modules(test-import Test Core)
- set(QT_LIBRARIES "")
-endif()
+qt5_use_modules(test-import Test Core)
+set(QT_LIBRARIES "")
target_link_libraries(test-import ${QT_LIBRARIES})
add_test(test-import test-import)
@@ -135,16 +116,10 @@ if(sqlcipher)
list(APPEND TESTREGEX_MOC_HDR ../CipherDialog.h)
endif()
-if(NOT USE_QT5)
- QT4_WRAP_CPP(TESTREGEX_MOC ${TESTREGEX_MOC_HDR})
-endif()
-
add_executable(test-regex ${TESTREGEX_MOC} ${TESTREGEX_HDR} ${TESTREGEX_SRC})
-if(USE_QT5)
- qt5_use_modules(test-regex Test Core Gui Widgets)
- set(QT_LIBRARIES "")
-endif()
+qt5_use_modules(test-regex Test Core Gui Widgets)
+set(QT_LIBRARIES "")
if(NOT ANTLR2_FOUND)
add_dependencies(test-regex antlr)
Oops, something went wrong.

0 comments on commit b9e4433

Please sign in to comment.