- 浏览: 766757 次
- 性别:
- 来自: 大连
-
最新评论
-
xuelj:
我的Android进阶之旅------>Android使用9Patch图片作为不失真背景 -
lBovinl:
,浩瀚~
我的Android进阶之旅------>经典的大客推荐(排名不分先后)!! -
xyy_zero:
看着听犀利的,大神,有demo吗?可以分享下不。我最近需要开发 ...
给android设备增加串口功能
文章列表
QButtonGroup的简单应用
所有代码都是在qt3.3.8+fedora8下运行的。
QButtonGroup用于统一管理一组QButton按钮。理论上所有继承自QButton的按钮类都可以使用。这里以QPushButton和QRadioButton为例演示。按钮分组的作用主要用在项目选择上,可以单选,也可以多选,根据属性设置而定。
头文件: <qbuttongroup.h>
主要属性和函数:int id:按钮的标签,可以用这个标签来获得或操作组里的各个按钮。
bool exclusive:This property holds whether the ...
- 2010-08-02 15:26
- 浏览 517
- 评论(0)
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QDebug"
#include "QCheckBox"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->tableWidget ...
- 2010-07-30 16:59
- 浏览 409
- 评论(0)
在QTableWidget中会经常用的checkBox,但是如何判断复选框是否被选中呢,方法是利用QTableWidget::cellChanged()函数,检查单元格内容的变化,然后连接此信号,在槽函数中检测checkBox的状态,代码如下:
查看源代码
打印帮助
...
- 2010-07-30 12:29
- 浏览 813
- 评论(0)
这篇文章是在Blogspot上看到的一篇文章,能够解决QString, wchar_t *, TCHAR和其他字符或字符串类型之间的转换,方便在使用Windows API的时候转换的麻烦。
原文地址:http://tkrotoff.blogspot.com/2010/04/code-snippets-about-qstring-wchart.html
1
//QString to wchar_t *:
2
const wchar_t * encodedName = reinterpret_cast<const wchar_t *>(file ...
- 2010-07-30 12:27
- 浏览 614
- 评论(0)
QWizard下一步按钮的控制
QWizard是Qt的向导类,在向导过程中,可以通过函数registerField注册字段实现全局访问,而且可以通过4种方法来控制下一步或者完成按钮的可用性:第一种方法,isComplete函数,其应用于QWizardPage,可控制单个向导页面的“下一步”或者“完成”按钮的可用性,函数如下:
1
bool QWizardPage::isComplete () const[virtual]
下面是isComplete的实现,源码来源于
http://doc.qt.nokia.com/qq/qq22-qwizard.h ...
- 2010-07-30 12:26
- 浏览 470
- 评论(0)
Qt下的模态和非模态对话框
模态对话框(Modal Dialog)与非模态对话框(Modeless Dialog)的概念不是Qt所独有的,在各种不同的平台下都存在。又有叫法是称为模式对话框,无模式对话框等。 所谓模态对话框就是在其没有被关闭之前,用户不能与同一个应用程序的其他窗口进行交互,直到该对话框关闭。对于非模态对话框,当被打开时,用户既可选择和 该对话框进行交互,也可以选择同应用程序的其他窗口交互。
在Qt中,显示一个对话框一般有两种方式,一种是使用exec()方法,它总是以模态来显示对话框;另一种是使用show()方法,它使得对话框既可以模态显示,也可以非 ...
- 2010-07-27 15:25
- 浏览 576
- 评论(0)
QThread的用法!
分类:QT-trolltech2007-08-01 15:17
#include <qthread.h>
class MyThread : public QThread { public: virtual void run(); }; void MyThread::run() { for( int count = 0; count < 20; count++ ) {sleep( 1 );qDebug( "Ping!" ); } } int main() { MyThread a; MyThread b ...
- 2010-07-21 17:58
- 浏览 298
- 评论(0)
Qt: 多线程, 就是这么简单
#include<iostream>#include<QApplication>#include<QThread>#include<QString>classThread:publicQThread{public:Thread(QStringname=""){stopped=false;this->name=name;
- 2010-07-21 17:55
- 浏览 582
- 评论(0)
一个QThread例子
//threadTest.h#ifndef THREADTEST_H#define THREADTEST_H
#include <qthread.h>#include "test.h"
class MyThread : public QThread{ protected : virtual void run();};
MyThread myThread;
void Test::newSlot(){ myThread.start();}
#endif
////////////////////////////////
...
- 2010-07-21 17:38
- 浏览 792
- 评论(0)
CompleteLineEdit::keyPressEvent(QKeyEvent*e){
if(!listView->isHidden()){
intkey=e->key();
intcount=listView->model()->rowCount();
QModelIndexcurrentIndex=listView->currentIndex();
if(Qt::Key_Down==key){
//按向下方向键时,移动光标选中下一个完成列表中的项 ...
- 2010-07-20 17:13
- 浏览 1061
- 评论(0)
QStatusBar* bar = ui->statusBar;//获取状态栏
//还有种写法:
//statusBar()->addWidget(locationLabel);//statusBar()->addWidget(formulaLabel, 1);
first_statusLabel = new QLabel;//新建标签
first_statusLabel->setMinimumSize(150,20);//设置标签最小尺寸
first_statusLabel->setFrameShape(QFrame::WinPanel);// ...
- 2010-07-20 12:00
- 浏览 322
- 评论(0)
文字对齐位置
//左对齐pushButton.setStyleSheet("QPushButton{text-align : left;}");//右对齐pushButton.setStyleSheet("QPushButton{text-align : right;}");
- 2010-07-20 11:59
- 浏览 377
- 评论(0)
QApplication::setOverrideCursor(Qt::WaitCursor);//程序段QApplication::restoreOverrideCursor();注意,程序段一般为需要执行事件较长的语句组成,比如读写文件
- 2010-07-20 11:51
- 浏览 455
- 评论(0)