Qt4之类似QQ的抽屉效果

用过以前版本的QQ没,比较早的,例如下面所示:

Qt4之类似QQ的抽屉效果_第1张图片


下面我例举一个,其它两个类似:

    QGroupBox *groupBox2 = new QGroupBox();
    
    toolButton2_1 = new QToolButton( );
    toolButton2_1->setText( tr( "pizicai" ) );
    toolButton2_1->setIcon( QPixmap( ":/images/1.png" ) );
    toolButton2_1->setIconSize( QPixmap( ":/images/1.png").size() );
    toolButton2_1->setAutoRaise( TRUE );
    toolButton2_1->setToolButtonStyle( Qt::ToolButtonTextUnderIcon);
    
    toolButton2_2 = new QToolButton();
    toolButton2_2->setText( tr( "feiyang" ) );
    toolButton2_2->setIcon( QPixmap( ":/images/2.png") );
    toolButton2_2->setIconSize( QPixmap( ":/images/2.png").size() );
    toolButton2_2->setAutoRaise( TRUE );
    toolButton2_2->setToolButtonStyle( Qt::ToolButtonTextUnderIcon);
    
    QVBoxLayout *layout2 = new QVBoxLayout(groupBox2);
    layout2->setMargin(10);
    layout2->setAlignment(Qt::AlignHCenter);    
    layout2->addWidget(toolButton2_1);
    layout2->addWidget(toolButton2_2);
    layout2->addStretch(); 


 this->addItem( ( QWidget* )groupBox2 , tr("stranger" ));


你可能感兴趣的:(Qt4之类似QQ的抽屉效果)