llwj0303的个人主页

http://www.qtcn.org/bbs/u/151773  [收藏] [复制]

llwj0303

  • 31

    关注

  • 13

    粉丝

  • 27

    访客

  • 等级:新手上路
  • 总积分:80
  • 男,2011-05-04

最后登录:2022-01-10

更多资料

日志

QList暂存一批对象的属性

2015-03-06 11:16
暂时存放到List中,在操作结束后做相应恢复。
  1. //将锁定的item编号暂存到locklist中,然后取消lock属性,以使用
    QList <int> lockList;
        foreach(CustomAbstractItem *item, childItems())
        {
            if(item->locked())
            {
                lockList.append(list.indexOf(item));
                item->lock(false);
            }
        }

    //使用完后恢复其lock属性
        foreach(int index, lockList)
        {
            if(dynamic_cast<CustomAbstractItem *>(list.at(index)))
            {
                dynamic_cast<CustomAbstractItem *>(list.at(index))->lock(true);
            }
        }

分类:QT|回复:0|浏览:891|全站可见|转载
 

Powered by phpwind v8.7 Certificate Copyright Time now is:04-19 11:03
©2005-2016 QTCN开发网 版权所有 Gzip disabled