add a basic TextEditor application
right now this is just a KTextArea in a KXmlGuiWindow.
This commit is contained in:
parent
a694946fb9
commit
a806a2fcfc
9 changed files with 99 additions and 18 deletions
|
@ -22,9 +22,8 @@ find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
|||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
CoreAddons
|
||||
I18n
|
||||
WidgetsAddons
|
||||
)
|
||||
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
|
|
@ -1,15 +1,2 @@
|
|||
add_executable(hello hello.cc)
|
||||
target_link_libraries(hello
|
||||
Qt5::Widgets
|
||||
KF5::CoreAddons
|
||||
KF5::WidgetsAddons
|
||||
)
|
||||
|
||||
add_executable(internationalization internationalization.cc)
|
||||
|
||||
target_link_libraries(internationalization
|
||||
Qt5::Widgets
|
||||
KF5::CoreAddons
|
||||
KF5::WidgetsAddons
|
||||
KF5::I18n
|
||||
)
|
||||
add_subdirectory(KMessageBox)
|
||||
add_subdirectory(TextEditor)
|
||||
|
|
18
src/KMessageBox/CMakeLists.txt
Normal file
18
src/KMessageBox/CMakeLists.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
WidgetsAddons
|
||||
)
|
||||
|
||||
add_executable(hello hello.cc)
|
||||
target_link_libraries(hello
|
||||
Qt5::Widgets
|
||||
KF5::CoreAddons
|
||||
KF5::WidgetsAddons
|
||||
)
|
||||
|
||||
add_executable(internationalization internationalization.cc)
|
||||
target_link_libraries(internationalization
|
||||
Qt5::Widgets
|
||||
KF5::CoreAddons
|
||||
KF5::WidgetsAddons
|
||||
KF5::I18n
|
||||
)
|
13
src/TextEditor/CMakeLists.txt
Normal file
13
src/TextEditor/CMakeLists.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
|
||||
XmlGui
|
||||
TextWidgets
|
||||
)
|
||||
|
||||
add_executable(TextEditor main.cc MainWindow.cc)
|
||||
target_link_libraries(TextEditor
|
||||
Qt5::Widgets
|
||||
KF5::CoreAddons
|
||||
KF5::I18n
|
||||
KF5::XmlGui
|
||||
KF5::TextWidgets
|
||||
)
|
12
src/TextEditor/MainWindow.cc
Normal file
12
src/TextEditor/MainWindow.cc
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "MainWindow.hh"
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent)
|
||||
: KXmlGuiWindow(parent)
|
||||
{
|
||||
// setup the TextArea
|
||||
textArea = new KTextEdit();
|
||||
// set the central widget to be the TextArea
|
||||
setCentralWidget(textArea);
|
||||
// setup the GUI
|
||||
setupGUI();
|
||||
}
|
15
src/TextEditor/MainWindow.hh
Normal file
15
src/TextEditor/MainWindow.hh
Normal file
|
@ -0,0 +1,15 @@
|
|||
#ifndef MainWindow_H
|
||||
#define MainWindow_H
|
||||
|
||||
#include <KTextEdit>
|
||||
#include <KXmlGuiWindow>
|
||||
|
||||
class MainWindow : public KXmlGuiWindow {
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
KTextEdit* textArea;
|
||||
};
|
||||
|
||||
#endif
|
37
src/TextEditor/main.cc
Normal file
37
src/TextEditor/main.cc
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include "MainWindow.hh"
|
||||
#include <KAboutData>
|
||||
#include <KLocalizedString>
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
KLocalizedString::setApplicationDomain("MainWindow");
|
||||
|
||||
KAboutData aboutData(
|
||||
// Internal Name
|
||||
QStringLiteral("MainWindow"),
|
||||
// Name
|
||||
i18n("Text Editor"),
|
||||
// Version Number
|
||||
QStringLiteral("1.0"),
|
||||
// Short Description
|
||||
i18n("A text editor."),
|
||||
// License
|
||||
KAboutLicense::Custom,
|
||||
// Copyright Statement
|
||||
i18n("2023"));
|
||||
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
|
||||
QCommandLineParser parser;
|
||||
aboutData.setupCommandLine(&parser);
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
|
||||
MainWindow* window = new MainWindow();
|
||||
window->show();
|
||||
|
||||
return app.exec();
|
||||
}
|
Loading…
Reference in a new issue