2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef BOOKWINDOW_H
|
|
|
|
#define BOOKWINDOW_H
|
|
|
|
|
2024-01-12 23:00:41 +00:00
|
|
|
#include <QMainWindow>
|
2024-07-02 14:02:54 +00:00
|
|
|
|
2024-01-12 23:00:41 +00:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QComboBox)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QGridLayout)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QLabel)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QLineEdit)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QSpinBox)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QSqlError)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QSqlRelationalTableModel)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QTableView)
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
class BookWindow: public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
BookWindow();
|
|
|
|
|
2018-06-13 11:04:10 +00:00
|
|
|
private slots:
|
|
|
|
void about();
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
private:
|
|
|
|
void showError(const QSqlError &err);
|
2023-05-15 08:40:56 +00:00
|
|
|
QSqlRelationalTableModel *model = nullptr;
|
|
|
|
int authorIdx = 0, genreIdx = 0;
|
2018-06-13 11:04:10 +00:00
|
|
|
|
2023-11-01 13:18:14 +00:00
|
|
|
void createLayout();
|
|
|
|
void createModel();
|
|
|
|
void configureWidgets();
|
|
|
|
void createMappings();
|
2018-06-13 11:04:10 +00:00
|
|
|
void createMenuBar();
|
2023-11-01 13:18:14 +00:00
|
|
|
|
|
|
|
QWidget *window = nullptr;
|
|
|
|
|
|
|
|
QGridLayout *gridLayout = nullptr;
|
|
|
|
QTableView *tableView = nullptr;
|
|
|
|
QLabel *titleLabel = nullptr;
|
|
|
|
QLineEdit *titleLineEdit = nullptr;
|
|
|
|
QLabel *authorLabel = nullptr;
|
|
|
|
QComboBox *authorComboBox = nullptr;
|
|
|
|
QLabel *genreLabel = nullptr;
|
|
|
|
QComboBox *genreComboBox = nullptr;
|
|
|
|
QLabel *yearLabel = nullptr;
|
|
|
|
QSpinBox *yearSpinBox = nullptr;
|
|
|
|
QLabel *ratingLabel = nullptr;
|
|
|
|
QComboBox *ratingComboBox = nullptr;
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|