先贴上效果图,注意,没有写逻辑,都是乱动的

这篇我来说说左侧的这个进度条的实现原理,其实更简单,哈哈哈

有一个大的widget,根据素材,我放了10个label

剩下的就是写一个函数,根据数据的不同,实时控制这10个label的显示,

实现代码

void Widget::show_Lline(int num)
{ switch (num) {
case 0:
{
ui->label_lline_1->hide();
ui->label_lline_2->hide();
ui->label_lline_3->hide();
ui->label_lline_4->hide();
ui->label_lline_5->hide();
ui->label_lline_6->hide();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 1:
{
ui->label_lline_1->show();
ui->label_lline_2->hide();
ui->label_lline_3->hide();
ui->label_lline_4->hide();
ui->label_lline_5->hide();
ui->label_lline_6->hide();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 2:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->hide();
ui->label_lline_4->hide();
ui->label_lline_5->hide();
ui->label_lline_6->hide();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 3:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->hide();
ui->label_lline_5->hide();
ui->label_lline_6->hide();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 4:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->hide();
ui->label_lline_6->hide();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 5:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->show();
ui->label_lline_6->hide();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 6:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->show();
ui->label_lline_6->show();
ui->label_lline_7->hide();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 7:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->show();
ui->label_lline_6->show();
ui->label_lline_7->show();
ui->label_lline_8->hide();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 8:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->show();
ui->label_lline_6->show();
ui->label_lline_7->show();
ui->label_lline_8->show();
ui->label_lline_9->hide();
ui->label_lline_10->hide();
break;
}
case 9:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->show();
ui->label_lline_6->show();
ui->label_lline_7->show();
ui->label_lline_8->show();
ui->label_lline_9->show();
ui->label_lline_10->hide();
break;
}
case 10:
{
ui->label_lline_1->show();
ui->label_lline_2->show();
ui->label_lline_3->show();
ui->label_lline_4->show();
ui->label_lline_5->show();
ui->label_lline_6->show();
ui->label_lline_7->show();
ui->label_lline_8->show();
ui->label_lline_9->show();
ui->label_lline_10->show();
break;
}
default:
break;
}
}

这样,就可以了

最新文章

  1. 《Continuous Delivery》 Notes 2: Configuration Management
  2. HDU4550+贪心
  3. codeforces 711B B. Chris and Magic Square(水题)
  4. iftop
  5. http://blog.csdn.net/foreverling/article/details/51385128
  6. 基于WebForm+EasyUI的业务管理系统形成之旅 -- 构建Web界面(Ⅴ)
  7. @Index用法——javax.persistence.Index
  8. 玩了一下SDN:MININET+FLOODLIGHT,感觉这确实是一个趋势啊
  9. [.NET] 《C# 高效编程》(一) - C# 语言习惯
  10. Node.js_express_服务器渲染页面 ejs
  11. JS_单个或多个文件上传_不支持单独修改
  12. AJAX请求返回HTTP 400 错误 - 请求无效 (Bad request)
  13. Unity-使用面向对象的思想
  14. PHP中使用CURL实现GET和POST请求(转载)
  15. [developmemt][dpdk] dpdk优化(转)
  16. 多线程——interrupt方法
  17. input 原生上传文件(type = file)
  18. CSS控制Span强制换行亲测
  19. Webpack vs Gulp(转载)
  20. MFC—— AfxMessageBox

热门文章

  1. 论坛数据转换discuz论坛?
  2. linux命令进阶及和windows进行文件传输的所有方式
  3. Spring知识点总结(三)之Spring DI
  4. PL/SQL 用户自定义子类型
  5. Invalid default value for prop "value": Props with type Object/Array must use a factory function to return the default value.(props default 数组/对象的默认值应当由一个工厂函数返回)
  6. ABAP术语-IAC (Internet Application Components)
  7. (四)、python 集合与格式化
  8. 【c学习-10】
  9. ECSHOP和SHOPEX快递单号查询德邦插件V8.6专版
  10. MIP组件开发 自定义js组件开发步骤