mainwindow.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3. #include "QtGui/qstandarditemmodel.h"
  4. #include "QtWidgets/qlistview.h"
  5. #include "QtWidgets/qlistwidget.h"
  6. #include "dialog.h"
  7. #include <QMainWindow>
  8. #include <QDir>
  9. #include <QFile>
  10. #include <QTextStream>
  11. #include <QFile>
  12. #include <QJsonDocument>
  13. #include <QJsonObject>
  14. #include <QJsonArray>
  15. #include <QDebug>
  16. #include"../sample_button_slide/CustomButton.h"
  17. #include"../test_drag/mylistwidget.h"
  18. #include "tool.h"
  19. QT_BEGIN_NAMESPACE
  20. namespace Ui { class MainWindow; }
  21. QT_END_NAMESPACE
  22. class MainWindow : public QMainWindow
  23. {
  24. Q_OBJECT
  25. public:
  26. MainWindow(QWidget *parent = nullptr);
  27. ~MainWindow();
  28. private:
  29. Ui::MainWindow *ui;
  30. Dialog *dialog;
  31. QJsonArray QJA;//保存了左侧树的结构 QJA QJsonArray([{"children":[{"name":"version1"},{"name":"version2"},{"name":"version3"}],"name":"tes1"},{"children":[],"name":"tet2"}])
  32. QJsonArray RQJA;//保存右侧的分组的结构
  33. QListWidget* qlw;
  34. QJsonObject QJO;
  35. CustomButton* customB2;
  36. CustomButton* customB3;
  37. CustomButton* customB4;
  38. MyListWidget* my1;
  39. MyListWidget* my2;
  40. MyListWidget* my3;
  41. MyListWidget* my4;
  42. QString config_json_path;
  43. QString treeview_path;
  44. QString root_pro_path;
  45. void add_slide();
  46. void readFile(const QString& filePath);
  47. QJsonObject readJsonFile(const QString& filePath);
  48. void init();
  49. void inittreeview(QJsonValueRef qvr);
  50. void init2();
  51. void initTreeView(QStandardItem* parentItem,const QJsonArray& jsonArray);
  52. void initComboBox(QStringList jsonPath);
  53. void initRight(QString parentNode,QString childNode);
  54. void initRightListwidget(QListWidget* qv,const QJsonArray& qja);
  55. void updateConfig(QListWidget* qw);
  56. void writeBackToConfigJson();
  57. void clearRight();
  58. private slots:
  59. void on_pushButton_clicked();
  60. void on_pushButton_2_clicked();
  61. void on_pushButton_4_clicked();
  62. void slotTreeMenu(const QPoint &pos);
  63. void slotTreeMenuExpand(bool checked = false);
  64. void slotTreeMenuCollapse(bool checked = false);
  65. void slotTreeMenuDelete(bool checked = false);
  66. void on_treeView_clicked(const QModelIndex &index);
  67. void on_listWidget_customContextMenuRequested(const QPoint &pos);
  68. void deleteSeedSlot();
  69. void on_listWidget_2_customContextMenuRequested(const QPoint &pos);
  70. void on_listWidget_3_customContextMenuRequested(const QPoint &pos);
  71. void on_listWidget_4_customContextMenuRequested(const QPoint &pos);
  72. void onWidgetClicked();
  73. void on_comboBox_currentTextChanged(const QString &arg1);
  74. void handleOperationCompleted(QString fromfilePath);
  75. };
  76. #endif // MAINWINDOW_H