发现有人将GRASS包装成Qt库,可以在Qt程序里应用GRASS,
当然还是很初步的东西,目前的功能包括:
1.
对层(layers)的着色进行控制
2. 在painter上面显示2维的矢量和栅格图形
3. 放大缩小
4. 漫游
5.
xy到经纬度的转换
6. 两点间距离的量算
详细请见 http://navicon.dk/web/normal.php?pageid=92
Category Archives: Qt
一个Qt论坛
发现一个Qt相关的技术论坛,很好!
这是地址:http://prog.org.ru/forum/forum_14_293a41060711d9f8a71a60fe1e5e890e.html
另外,俄罗斯的盗版好象比中国的还要厉害,很多新软件,在google.ru上都能找着破解
一 个小 tip,特别是找软件破解的时候,不妨除了用google.com,也用用google.ru等区域性的搜索,也许会带给你惊喜;另外最新的软件一般都出 现在eDonkey上面,所以不要忘了到eDonkey上找找(这不是bt可以替代的,eDonkey上的资源很丰富,当然内容也是乱七八糟的,就看大家 如何对待了)。
revised lineEdit
void PmFocusHandledLineEdit::focusInEvent( QFocusEvent * event )
{
if (event->reason()==Qt::MouseFocusReason)
{
QFocusEvent *fe=new QFocusEvent(QEvent::FocusIn, Qt::TabFocusReason);
QApplication::postEvent(this, fe);
}
else
{
QLineEdit::focusInEvent(event);
}
}
Qt中的事件
giscn[at]msn[dot]com
来源于a)windows系统的事件,经Qt的包装(如QMouseEvent);b)Qt内置的事件(如
2.1 重载虚拟方法
比如一个按钮,要自定义左键click时的行为,可以这样做:
a. 从一个QPushButton上派生一个子类如MyPushButton
b. 重载void MyPushButton::mousePressEvent(QMouseEvent *event)
* 一般来讲,除非要重新改写这个事件的默认行为,否则如果仅是为了扩展其功能,最好在
* 在调用mousePressEvent这些特定的事件前,先调用通用事件处理函数,QObject::event()
2.2 event filter(事件过滤器)方法
一个对象的event filter的处理优先级在 该对象的 event()方法调用之前。这时,filter对
* 使用QCoreApplication的事件过滤,可以将任何事件在进行具体对象之前,进行处理。但
- Reimplementing QCoreApplication::notify. This is very powerful, providing complete control; but only one subclass can be active at a time.
- Installing an event filter on QCoreApplication::instance(). Such an event filter is able to process all events for all widgets, so it’s just as powerful as reimplementing notify(); furthermore, it’s possible to have more than one application-global event filter. Global event filters even see mouse events for disabled widgets.
- Reimplementing QObject::event() (as QWidget does). If you do this you get Tab key presses, and you get to see the events before any widget-specific event filters.
- Installing an event filter on the object. Such an event filter gets all the events except Tab and Shift-Tab key presses.
- Reimplementing paintEvent(), mousePressEvent() and so on. This is the commonest, easiest and least powerful way.
3.1 自定义事件从QEvent派出,该event number必须大于QEvent::User
3.2 使用postEvent和sendEvent方法派遣自定义事件
* postEvent实质是将事件推进事件循环(event loop),马上返回。事件的实际发送可能在稍
* 在某种意义上,程序可以直接调用对象的对应事件函数,而绕过postEvent。但存在不足,
* sendEvent等待事件被发送成功或失败后才返回。
* postEvent的一个好处是多个posted的event可以被压缩成单一的event,从而提高了效率。
* 可以使用QCoreApplication::sendPostedEvents强迫Qt马上进入事件循环(event loop)派
如果事件在目标对象上得不到处理,事件向上一层进行传播,直到最顶层的widget为止。
如果得到事件的对象,调用了accept(),则事件停止继续传播;如果调用了ignore(),事件向上一级继续传播。
Qt对自定义事件处理函数的默认返回值是accept(),但默认的事件处理函数是ingore()。因此,如果要继续向上传播,调用QWidget的默认处理函数即可。到时为止的话,不必显式调用accept()。
但在event处理函数里,返回true表示accept,返回false表示向上级传播。
* 在closeEvent是个特殊情形,accept表示quit,ignore表示取消,所以最好在closeEvent显式调用accept和ignore。
5.1 使用event->type得到事件的具体类型,对之进行判断,是否是需要的类型(比如
5.2 使用static_cast<specific event type *>对通用事件转换成特定类型,比如将event转
5.3 使用sendEvent时,参数 event,必须是局部变量,因为sendEvent不负责对event的删除
got Qt win commercial desktop 4.0.0 trial
QString与printf的%s
QString str("hello");
printf("%s
", str.data()); //只打印出h
//这是由于在qt4里每个char存留unicode,第二字节为零
解决方法
1. printf("%s
", qPrintable(str));
//qPrintable在qt文档里没有出现,但可在其源码里发现
2. printf("%s
", str.toLatin1());
//toLatin1,toUtf8,toLocal8bit返回QByteArray,可以自动转成 char*
Qspinbox的setMaximum会引起valueChanged事件
compile qt with msvc.net
//2. run configure with win32-g++ // obselete, a good methods here
3. cvs_qtmsvc_bcc.zip should merge with qt4msvc_bcc.zip, then overwrote by files from mkspecs-from-evaluation-version
4. set qmakespec to win32-msvc.net
4.1 rename the License.cpl to license.TROLL
4.2 copy qmake-from-eval to qmake dir, rename to qmake.exe
4.2 open the makefile under the qmake dir, comments the all: xxx line, and then add a line "all: "
4.3 run configure, it will configure for you.
5. use qmake -recursive to generate makefiles (in general, this step
will be done during the configure process. but, if you run with any
other makespec rather than msvc.net, please do it again. In a clean installation, it’s ok to skip this step)
6. nmake all files, it will cost much time. but, you can stop it at any
time, and then simply run nmake again to continue the process.
qt 4 installed with msvc.net and dev-c++
qt 4 installed with msvc.net and dev-c++
adipose from qt forum has summerized some points in how to compile qt 4 source open version with msvc.net. here is its url
this thread also address some ideas on how to make qt4 work with dev-c++. apart from this thread, there are some as following:
http://sourceforge.net/forum/forum.php?thread_id=1314521&forum_id=48211
http://www.hoppelkoppel.de/docs/InstallationQt.pdf
http://evilissimo-softdev.de/files/stuff/qt-devcpp-template.txt
http://www.c-plusplus.de/forum/viewtopic-var-t-is-114023-….html
hope to help.