alexltr的个人主页

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

alexltr

我不是IT,只是喜欢Qt。 我不是程序员,只是与程序有缘。

  • 26

    关注

  • 60

    粉丝

  • 150

    访客

  • 等级:骑士
  • 身份:论坛版主
  • 总积分:537
  • 男,1976-01-01
  • 广州

最后登录:2024-02-14

更多资料

日志

2012-05-19 22:54

VB中的字符连接太麻烦了,特别是写SQL字符串时更麻烦,里面有单引号,双引号,逗号,连字符,变量等一大堆,乱七八糟的,搞得我晕头转向,稍不留神就会写错,还是Qt里的QString().arg()好用,简单明了,条理清晰。
受到QString().arg()的启发,把VB代码改成如下,这样就清晰多了,即使多写几行代码也是值得的。至于执行效率就不知道了。
复制代码.................
strNewStyleNo = Replace(strStyleNamePattern, "___", strZeroForFill & i)
strCreatedBy = Application.UserName
dteCreateDate = Now()
strInsertValue ..

阅读全文»分类:默认分类|回复:0|浏览:1504
2012-05-06 20:16

Proxy models
代理模型


In the model/view framework, items of data supplied by a single model can be shared by any number of views, and each of these can possibly represent the same information in completely different ways. Custom views and delegates are effective ways to provide radically different representations of the same data. However, applications often need to provide conventional views onto processed versions of the same data, such as differently-sorted views onto a list of items.
在模 ..

阅读全文»分类:默认分类|回复:0|浏览:2270
2012-05-06 15:57

Using model/view classes
使用模型/视图类

Setting up a view for drag and dropfollows the same pattern used with the convenience views. For example, a QListView canbe set up in the same way as aQListWidget:
建立一个可以拖放的基于模型的视图跟简便类视图是一样的模式。例如,可以用建立QListWidget一样的方法建立一个QListView:

复制代码QListView *listView = newQListView(this);
listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
listView->setDragEnabled(true);
listView->setAcc ..

阅读全文»分类:默认分类|回复:0|浏览:2388
2012-04-29 14:34

Item view convenience classes
项视图简便类

Qt 4 also introduced some standardwidgets to provide classic item-based container widgets. These behave in asimilar way to the item view classes in Qt 3, but have been rewritten to usethe underlying model/view framework for performance and maintainability. Theold item view classes are still available in the compatibility library (see the Porting Guide for more information).

Qt4 同时也引入了一些标准部件以提供传统的基于项的容器部件。这些部件的作用跟Qt ..

阅读全文»分类:默认分类|回复:0|浏览:3867
2012-04-29 14:24

Creating new models
建立新的模型

The separation of functionality between themodel/view components allows models to be created that can take advantage ofexisting views. This approach lets us present data from a variety of sourcesusing standard graphical user interface components, such as QListView, QTableView, and QTreeView.
模型与视图的部件在功能上的分离,使得可以建立模型并能利用现有的视图。这种方法让我们可以使用标准的图形用户界面部件,如QListView, QTableView, 和QTreeView,来呈现多样化来源的 ..

阅读全文»分类:默认分类|回复:0|浏览:2148
2012-04-29 14:16

Handling selections in item views
项视图的选择处理

Concepts
概念

The selection model used in the item view classesoffers many improvements over the selection model used in Qt 3. It provides amore general description of selections based on the facilities of themodel/view architecture. Although the standard classes for manipulatingselections are sufficient for the item views provided, the selection modelallows you to create specialized selection models to suit the requirements foryour own it ..

阅读全文»分类:默认分类|回复:0|浏览:2358
2012-02-11 12:01

最近来论坛的时间少了。
继去年买了一本《C++ GUI Qt 4编程》后,上星期又买了一本《高级Qt编程》。
很同意论坛里一些朋友的说法,看书学习还是看实体书好一点。
希望今年有更多时间用在学习上。

阅读全文»分类:默认分类|回复:0|浏览:1225
2011-11-27 21:20

Delegate classes
委托类

Concepts
概念

Unlike the Model-View-Controller pattern, the model/view design does not include a completely separate component for managing interaction with the user. Generally, the view is responsible for the presentation of model data to the user, and for processing user input. To allow some flexibility in the way this input is obtained, the interaction is performed by delegates. These components provide input capabilities and are also responsible for rendering indi ..

阅读全文»分类:默认分类|回复:0|浏览:2301
2011-11-26 21:07

Model classes
模型类

Before examining how selections are handled, you may find it useful to examine the concepts used in the model/view framework.
在检验如何处理选择项之前,我们先来了解一下模型/视图框架里用到的概念。

Basic concepts
基本概念

In the model/view architecture, the model provides a standard interface that views and delegates use to access data. In Qt, the standard interface is defined by the QAbstractItemModel class. No matter how the items of data are stored in any underlying da ..

阅读全文»分类:默认分类|回复:0|浏览:2198
2011-11-26 20:45

提供QTableWidget和QHeaderView来调节QTextTable的栏宽

写代码前感觉应该很简单。真正写的时候却遇到了不少问题,调试过程中也发现了很多写代码前没有考虑到的细节。以边学边写,不断调试,搞了好多天了。

现在回过来看,代码确实很简单。但有些细节还是没有处理到。如表格在文本的第一行时,此调节控件显示不出来。还有些槽函数可能要变为公用的。

mytableadjustor.h
复制代码#ifndef MYTABLEADJUSTOR_H
#define MYTABLEADJUSTOR_H

#include <QTableWidget>
#include <QHeaderView>
#include <QTextEdit>
#incl ..

阅读全文»分类:默认分类|回复:0|浏览:2490
12

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