#ifndef CUSTOMCOMBOBOX_H #define CUSTOMCOMBOBOX_H #include /** * @brief 使用此类绘制下拉框阴影需要在样式表中设置QAbstractItemView {margin: LISTVIEW_MARGIN;} */ class CustomComboBox : public QComboBox { public: explicit CustomComboBox(QWidget *parent = nullptr); ~CustomComboBox(); //重写下拉框弹出位置 void showPopup() override; private: const int LISTVIEW_MARGIN = 8; // QAbstractItemView边距(阴影宽度) }; #endif // CUSTOMCOMBOBOX_H