摘要: Q_PROPERTYQ_PROPERTY()是一个宏,用来在一个类中声明一个属性property,由于该宏是qt特有的,需要用moc进行编译,故必须继承于QObject类。 Q_PROPERTY(type name READ getFunction [WRITE setFunction] [RESET resetFunction] [NOTIFY notifySignal] [DESIGNABLE bool] [SCRIPTABLE bool] [STORED bool] [USER bool] [CONSTANT] [FINAL])可能还不太好理解 不过下面介绍几个特殊的例子你就豁然开朗了 阅读全文
posted @ 2012-06-26 15:20 戈壁子规 阅读(8572) 评论(0) 推荐(0)
摘要: class B{public: explicit B(int x = 0, bool flag = true); //explicit防止隐式转换 B(const B &bObj); //copy constructor , passed by value B& operater= (const B &bObj); // copy assignment}void dosomething(B obj);dosomething(B(20)); //利用class B的构造函数 显示转换将int转换成B------------------------------------- 阅读全文
posted @ 2012-06-18 17:57 戈壁子规 阅读(172) 评论(0) 推荐(0)
摘要: 隐藏鼠标——以qws方式运行的程序中执行 QWSServer::setCursorVisible(false); QWidget::setCursor(QCursor(Qt::BlankCursor)); //Qt::ArrowCursor;窗口全屏 方法1:使用函数setWindowFlags()函数 例:yourwidget->setWindowFlags(Qt::Window | Qt::FramelessWindowHint); (第一个Qt::window表示此widget是窗口类型,第二个参数使用无框架就是没有标题,状态栏和边框) 方法2:使用showFullScreen() 阅读全文
posted @ 2012-06-15 17:54 戈壁子规 阅读(181) 评论(0) 推荐(0)
摘要: grub/etc/fstab文件# /etc/fstab: static file system information.# <file system> <mount point> <type> <options> <dump> <pass>proc /proc proc defaults 0 0#/dev/sda1 / ext3 defaults,errors=remount-ro 0 1UUID=4f1a87c0-b065-44d8-a6b... 阅读全文
posted @ 2012-05-31 17:48 戈壁子规 阅读(1337) 评论(0) 推荐(0)
摘要: 经过连续几天的折腾,利用lfs-livecd6.3终于编出了完全自定义的linux系统今天最后一步,启动U盘linux:修改menu.lst---> root (hd0,0)kernel=(hd0,0)/vmlinuzroot=(hd0,0)/dev/sdx1 如果直接写root=/dev/sda1则会报错 grub error 11 unrecognized device string再次启动kernel panic not syncing: vfs: unable to mount root fs on umknown-block(8,5) 阅读全文
posted @ 2012-05-30 19:47 戈壁子规 阅读(226) 评论(0) 推荐(0)
摘要: file-modesetuid-setgid-sticky bit可执行文件的执行时的两种权限 1.调用文件者的权限 2.文件拥有者的权限 , setuid和setgid可以将文件从权限1提升到权限2sticky理解为防删除: 拥有x标志的文件权限 1.用户组对目录有删除文件和建立文件的权限 2.用户组对目录只有建立文件的权限,不能删除文件, sticky将用户的x权限限制为s就是从权限1到权限2切换rwsrw-r– 表示有setuid标志rwxrwsrw- 表示有setgid标志rwxrw-rwt 表示有sticky标志chmod -v u+s filename 4644chmod -v g 阅读全文
posted @ 2012-05-26 21:32 戈壁子规 阅读(163) 评论(0) 推荐(0)
摘要: 部分shell命令执行时可能需要获取终端用户的输入信息,导致脚本停止等待用户输入,如果输入值固定则自动进行输入则更方便找到了tcl/tk的工具expect安装 sudo apt-get install tcl8.5使用gpg进行加密解密文件时需要输入密钥,为了能够利用gpg全自动加密文件,写出如下脚本#!/usr/bin/expectspawn gpg -c -o file.enc file2encryptexpect "密码: "send "code\r"#密码确认、expect "密码: "send "code\r&qu 阅读全文
posted @ 2012-05-23 17:40 戈壁子规 阅读(872) 评论(0) 推荐(0)
摘要: 1.为什么没有写QObject::tr(),而仅仅是tr()呢?原来,tr()函数是定义在Object里面的,所有使用了Q_OBJECT宏的类都自动具有tr()函数2.setbuddy函数用于转移焦点3.QH/VBoxLayout 的addstretch()函数,布局空白处 阅读全文
posted @ 2012-05-21 17:55 戈壁子规 阅读(132) 评论(0) 推荐(0)
摘要: 今日将tslib1.4编译进qt编译选项./configure -release -shared -fast -no-largefile -qt-sql-sqlite -no-qt3support -no-xmlpatterns -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -make libs -xplatform qws/linux-arm-gnueabi-g++ -nomake tools -nomake exampl 阅读全文
posted @ 2012-05-17 17:32 戈壁子规 阅读(490) 评论(0) 推荐(0)
摘要: 编译tslib-1.4 修改环境变量: /etc/profile中增加 export PATH=$PATH:/交叉编译工具链所在的bin目录maemo@maemo-desktop:~/platform/tslib$ source /etc/profile./configure --prefix=/usr/local/tslib-1.4 --host=arm-none-linux-gnueabi ac_cv_func_malloc_0_nonnull=yes -silent下载qt-everywhere-opensource-src-4.8.1.tar.gz解压之后进入源码目录:./config 阅读全文
posted @ 2012-05-16 17:51 戈壁子规 阅读(558) 评论(0) 推荐(0)