Chinaunix首页 | 论坛 | 博客
  • 博客访问: 183282
  • 博文数量: 35
  • 博客积分: 762
  • 博客等级: 上士
  • 技术积分: 317
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-30 21:38
文章分类

全部博文(35)

文章存档

2015年(1)

2013年(3)

2012年(1)

2011年(30)

分类: WINDOWS

2011-08-26 17:32:12

  1. void onemaingui::shrink()
  2. {
  3.     if(shrink_bool == false)
  4.     {
  5.         this->setFixedSize(this->size().width()-20,this->size().height());
  6.         shrinkButton->setGeometry(QRect(shrinkButton->x()-20, 5, 26, 31));
  7.         if(this->size().width()<=shrinkButton->width()+2)
  8.         {
  9.             widget->hide();
  10.             timer_shrink->stop();
  11.             shrink_bool=true;
  12.             shrinkButton->setStyleSheet(QString(".QPushButton{border-image: url(./images/show.png);}"));
  13.             if(!splitScreen->isHidden())
  14.             {
  15.                 splitScreen->hide();
  16.             }
  17.             else
  18.             {
  19.                 operate->hide();
  20.             }
  21.         }
  22.     }
  23.     else
  24.     {
  25.         widget->show();
  26.         splitScreen->show();
  27.         if(this->size().width()<=810)
  28.         {
  29.             this->setFixedSize(this->size().width()+20,this->size().height());
  30.             shrinkButton->setGeometry(QRect(shrinkButton->x()+20, 5, 26, 31));
  31.         }
  32.         else
  33.         {
  34.              shrinkButton->setStyleSheet(QString(".QPushButton{border-image: url(./images/shrink.png);}"));
  35.             timer_shrink->stop();
  36.             shrink_bool=false;
  37.             lock_bool=true;
  38.             this->setFixedSize(830,this->size().height());
  39.         }
  40.     }
  41. }
  42. //向左缩进
    1. timer_shrink= new QTimer(this);
    2.  connect(timer_shrink, SIGNAL(timeout()), this, SLOT(shrink()));
    3. timer_shrink->start(10);
阅读(3003) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~