问题描述
- QQ抽屉效果原来????????
-
#include "drawer.h" #include <QGroupBox> #include <QVBoxLayout> Drawer::Drawer(QWidget *parent): QToolBox(parent) { setWindowTitle(tr("My QQ")); toolBtn1_1=new QToolButton; toolBtn1_1->setText(tr("张三")); toolBtn1_1->setIcon(QPixmap("")); toolBtn1_1->setIconSize(QPixmap("").size()); toolBtn1_1->setAutoRaise(true); toolBtn1_1->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); toolBtn1_2=new QToolButton; toolBtn1_2->setText(tr("李四")); toolBtn1_2->setIcon(QPixmap("")); toolBtn1_2->setIconSize(QPixmap("").size()); toolBtn1_2->setAutoRaise(true); toolBtn1_2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QGroupBox *groupBox1=new QGroupBox; QVBoxLayout *layout1=new QVBoxLayout(groupBox1); layout1->setMargin(10); layout1->setAlignment(Qt::AlignHCenter); layout1->addWidget(toolBtn1_1); layout1->addWidget(toolBtn1_2); layout1->addStretch(); toolBtn2_1=new QToolButton; toolBtn2_1->setText(tr("小王")); toolBtn2_1->setIcon(QPixmap("")); toolBtn2_1->setIconSize(QPixmap("").size()); toolBtn2_1->setAutoRaise(true); toolBtn2_1->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QGroupBox *groupBox2=new QGroupBox; QVBoxLayout *layout2=new QVBoxLayout(groupBox2); layout2->setMargin(10); layout2->setAlignment(Qt::AlignHCenter); layout2->addWidget(toolBtn2_1); toolBtn3_1=new QToolButton; toolBtn3_1->setText(tr("小赵")); toolBtn3_1->setIcon(QPixmap("")); toolBtn3_1->setIconSize(QPixmap("").size()); toolBtn3_1->setAutoRaise(true); toolBtn3_1->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); QGroupBox *groupBox3=new QGroupBox; QVBoxLayout *layout3=new QVBoxLayout(groupBox3); layout3->setMargin(10); layout3->setAlignment(Qt::AlignHCenter); layout3->addWidget(toolBtn3_1); this->addItem((QWidget*)groupBox1,tr("我的好友")); this->addItem((QWidget*)groupBox2,tr("陌生人")); this->addItem((QWidget*)groupBox3,tr("黑名单")); }
解决方案
不好意思,发错了。。。。。。。。。。。。。。。
时间: 2024-10-22 15:31:10