modelpage.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef MODELPAGE_H
  2. #define MODELPAGE_H
  3. #include <QWidget>
  4. #include <QTableView>
  5. #include <QPushButton>
  6. #include <QStandardItemModel>
  7. #include <QLabel>
  8. #include <QLineEdit>
  9. #include <QHBoxLayout>
  10. #include <QVBoxLayout>
  11. #include <QComboBox>
  12. #include <string>
  13. #include <QHeaderView>
  14. #include <QSpacerItem>
  15. #include <QGridLayout>
  16. #include <QDialog>
  17. #include <QFont>
  18. #include <QDebug>
  19. struct ModelInfo
  20. {
  21. public:
  22. std::string id;
  23. std::string name;
  24. std::string des;
  25. std::string path;
  26. std::string type;
  27. };
  28. static QList<ModelInfo*> modelList;
  29. class ModelAdd : public QDialog
  30. {
  31. Q_OBJECT
  32. public:
  33. explicit ModelAdd(QDialog *parent = nullptr);
  34. signals:
  35. void addModel();
  36. void sendModel();
  37. private:
  38. ModelInfo* mModelInfo;
  39. QLineEdit* setModelId ;
  40. QLineEdit* setModelName;
  41. QLineEdit* setModelDes ;
  42. QLineEdit* setModelPath ;
  43. QLineEdit* setModelType;
  44. };
  45. class ModelPage : public QWidget
  46. {
  47. Q_OBJECT
  48. public:
  49. explicit ModelPage(QWidget *parent = nullptr);
  50. void cptPageData(int count);
  51. void cptSubscripRange(int &mStart,int &mEnd);
  52. void setPageInfo(int i,int count,int curr);
  53. signals:
  54. public slots:
  55. void onSearchButtonClick();
  56. void onUpButtonClick();
  57. void onNextButtonClick();
  58. void onEditButtonClick();
  59. void onDelButtonClick();
  60. void onShowNews();
  61. private:
  62. void displayTable(int nStart,int nEnd);
  63. private:
  64. QTableView * modelTable;
  65. QStandardItemModel * itemModel;
  66. QLabel* mPageInfo;
  67. QLineEdit* mSetPage;
  68. int mTotalCount = 0 ; //一共多少条
  69. int mTotalPage = 0; //一共多少页
  70. int mCurrPage = 0; //当前第几页
  71. int mPerPageCnt = 9; //每页多少条
  72. bool flag = false;
  73. };
  74. #endif // MODELPAGE_H