qt焦点(播放器)

qq_26830049 2017-11-20 04:52:11
在写一个播放器,播放栏要无操作消失,用sethiden消失后,再显示回来,焦点没颜色了,虽然可以用,怎么回事?
...全文
176 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_26830049 2017-11-23
  • 打赏
  • 举报
回复
引用 1 楼 qqwangfan 的回复:
具体能贴下代码吗?这样看不出问题来
在楼下贴出来了
qq_26830049 2017-11-23
  • 打赏
  • 举报
回复
代码如下 初始化时:--------------------------------------------------------------------------------------------------------------------------------- PlayerButton::PlayerButton(QWidget *parent) : QWidget(parent) { #if 1 m_pHLayout_7 = new QHBoxLayout; m_pPlayButton = new QPushButton( this ); //播放、暂停 //m_pPauseButton = new QPushButton( this ); //暂停 m_pStopButton = new QPushButton( this ); //停止 m_pBackwardButton = new QPushButton( this ); //后退 m_pForwardButton = new QPushButton( this ); //快进 m_pCloseFileButton = new QPushButton( this ); //关闭 #endif //设置按钮图片和去焦点虚框 this->addButtonImages(m_pPlayButton,":/images/image/pause.png",QSize(38,38)); this->addButtonImages(m_pStopButton,":/images/image/stop.png",QSize(38,38)); this->addButtonImages(m_pBackwardButton,":/images/image/backward.png",QSize(38,38)); this->addButtonImages(m_pForwardButton,":/images/image/step.png",QSize(38,38)); this->addButtonImages(m_pCloseFileButton,":/images/image/openfile.png",QSize(38,38)); this->addButtonImages(m_pNextButton,":/images/image/next.png",QSize(38,38)); m_Playing=true; m_pLabelTiming = new QLabel(STR_PLAYER_TIME,this); //播放时间 QFont font1; font1.setBold(true); //加粗 font1.setPixelSize(23); m_pLabelTiming->setFont(font1); //设置控件的位置和大小 int xpos = 8+20; m_pPlayButton->setGeometry(xpos,gScreenH-LowHigh-6-15,45,45); xpos += 51; m_pNextButton->setGeometry(xpos,gScreenH-LowHigh-6-15,45,45); xpos += 51; m_pStopButton->setGeometry(xpos,gScreenH-LowHigh-6-15,45,45); xpos += 51; m_pBackwardButton->setGeometry(xpos,gScreenH-LowHigh-6-15,45,45); xpos += 51; m_pForwardButton->setGeometry(xpos,gScreenH-LowHigh-6-15,45,45); xpos += 51; m_pCloseFileButton->setGeometry(xpos,gScreenH-LowHigh-6-15,45,45); #if 1 connect( m_pNextButton, &QPushButton::clicked, this,&PlayerButton::nextplayButton); connect( m_pPlayButton, &QPushButton::clicked, this,&PlayerButton::playButton); //connect( m_pPauseButton, &QPushButton::clicked, this,&Dialog::pauseButton ); //安装事件过滤器,用于响应按键的显示 m_pNextButton->installEventFilter(this); m_pPlayButton->installEventFilter(this); m_pStopButton->installEventFilter(this); m_pBackwardButton->installEventFilter(this); m_pForwardButton->installEventFilter(this); m_pCloseFileButton->installEventFilter(this); } 添加按钮图片代码 //添加按钮图片 void PlayerButton::addButtonImages(QPushButton *button,const QString path,QSize size) { QIcon icon( path ); button->setIcon(icon); button->setIconSize(size); //隐藏边界 button->setFlat(true); //设置按钮自定义没有焦点虚框风格 button->setStyle(new noFocusStyle()); qDebug()<<"PlayerButton::addButtonImages"<<endl; }//添加图片结束 隐藏窗口 void PlayerButton::timehiden() { qDebug()<<"jindutiao hiden"<<endl; this->setHidden(true); this->update(); this->show(); this->setHidden(true); } 显示图片(在这里出问题,显示之后红框没了) void PlayerButton::setlayoutvisible() { this->setHidden(false); this->update(); this->show(); }
  • 打赏
  • 举报
回复
具体能贴下代码吗?这样看不出问题来

16,211

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧