于 Qt Widgets 于,我们经常使用许多布局管理器来管理界面 widgets 。

于 Qt Quick 实际上,有两个相关的管理和布局库,所谓集 Item Positioner ,所谓集 Item Layout 。 Item Layout 包含 RowLayout 、 ColumnLayout 、 GridLayout。与 Qt Widgets 中的布局管理器更相近,只是这里不打算介绍它们。本文的重点是 Item Positioner 。 Qt Quick 提供这么几种常常使用的 Positioners :

  • anchors ,锚布局
  • Row ,行布局
  • Column ,列布局
  • Grid ,表格布局
  • Flow ,流式布局

咱们一个一个来看。

请给我的决赛文章《Qt Quick 图像处理实例之美图秀秀(附源代码下载)》投票,谢谢。

版权全部 foruok 。转载请注明出处:http://blog.csdn.net/foruok 。

anchors(锚)布局

在《Qt on Android: Qt Quick 简单教程》一文中我们已经介绍过锚布局了。为了自成篇幅,这里再反复一下。只是演示样例会更新哦。

anchors 提供了一种方式,让你能够通过指定一个元素与其他元素的关系来确定元素在界面中的位置。

你能够想象一下,每一个 item 都有 7 条不可见的锚线:左(left)、水平中心(horizontalCenter)、上(top)、下(bottom)、右(right)、垂直中心(verticalCenter)、基线(baseline)。

看图 1 就明确了:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZm9ydW9r/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

图 1 锚线

在图 1 中。没有标注基线。基线是用于定位文本的,你能够想象一行文字端坐基线的情景。对于没有文本的图元。baseline 和 top 一致。

使用 anchors 布局时,除了对齐锚线,还能够在指定上(topMargin)、下(bottomMargin)、左(leftMargin)、右(rightMargin)四个边的留白。看图 2 就明确了:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZm9ydW9r/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

图 2 留白

除了图 1 和图 2 介绍的属性。 anchors 另一些属性。 centerIn 表示将一个 item 居中放置到另一个 item 内, fill 表示充满某个 item ……很多其他请參考 Item 类的文档。

好了。基础知识介绍完毕,看一个大而全的样例。文件名称是 anchors_layout.qml 。内容例如以下:

import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.centerIn: parent;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} //color pickers look at parent's top
ColorPicker {
id: topColor1;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.top: parent.top;
anchors.topMargin: 4;
onColorPicked: setTextColor(clr);
} ColorPicker {
id: topColor2;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.left: topColor1.right;
anchors.leftMargin: 4;
anchors.top: topColor1.top;
onColorPicked: setTextColor(clr);
} ColorPicker {
id: topColor3;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.right: parent.right;
anchors.rightMargin: 4;
anchors.top: parent.top;
anchors.topMargin: 4;
onColorPicked: setTextColor(clr);
} ColorPicker {
id: topColor4;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.right: topColor3.left;
anchors.rightMargin: 4;
anchors.top: topColor3.top;
onColorPicked: setTextColor(clr);
} //color pickers sit on parent's bottom
ColorPicker {
id: bottomColor1;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
onColorPicked: setTextColor(clr);
} ColorPicker {
id: bottomColor2;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.left: bottomColor1.right;
anchors.leftMargin: 4;
anchors.bottom: bottomColor1.bottom;
onColorPicked: setTextColor(clr);
} ColorPicker {
id: bottomColor3;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.right: parent.right;
anchors.rightMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
onColorPicked: setTextColor(clr);
} ColorPicker {
id: bottomColor4;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.right: bottomColor3.left;
anchors.rightMargin: 4;
anchors.bottom: bottomColor3.bottom;
onColorPicked: setTextColor(clr);
} //align to parent's left && vertical center
ColorPicker {
id: leftVCenterColor;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.verticalCenter: parent.verticalCenter;
onColorPicked: setTextColor(clr);
} //align to parent's right && vertical center
ColorPicker {
id: rightVCenterColor;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.right: parent.right;
anchors.rightMargin: 4;
anchors.verticalCenter: parent.verticalCenter;
onColorPicked: setTextColor(clr);
} //align to parent's top && horizontal center
ColorPicker {
id: topHCenterColor;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.top: parent.top;
anchors.topMargin: 4;
anchors.horizontalCenter: parent.horizontalCenter;
onColorPicked: setTextColor(clr);
} //align to parent's bottom && horizontal center
ColorPicker {
id: bottomHCenterColor;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
anchors.horizontalCenter: parent.horizontalCenter;
onColorPicked: setTextColor(clr);
}
}

演示样例代码中用到的 ColorPicker 是我们在《Qt Quick 组件与对象动态创建具体解释》中自己定义的组件,假设忘了请回头看看,要确保 ColorPicker.qml 与 anchors_layout.qml 在一个目录内。 ColorPicker 定义了 colorPicked 信号,參数为 clr 。类型是 color 。我在演示样例代码中为每一个 ColorPicker 对象创建了 onColorPicked 信号处理器,调用 setTextColor() 函数改变界面中间的文本的颜色。

Qt 是 QML 提供的一个全局对象,提供了非常多实用的方法和枚举值,这里我们使用 rgba() 函数来生成颜色值。

Math 对象是 JavaScript 语言那仅仅对象,它的 random() 方法放回 0 到 1 之间的随机值。

图 3 是运行 qmlscene anchors_layout.qml 后的效果图:

图 3 锚布局演示样例效果

锚布局是最灵活的一种 Qt Quick 布局方式,使用它你能够任意摆布界面上那些可见元素。只是,假设你的界面元素非常多,它也将是代码量最大的一种布局方式。

接下来我们看看那些传统的布局方式吧。假设你使用过 Qt Widgets ,相信会非常快明确。

行布局

anchors 实际上是 Item 的一个属性集。而 Row 则是一个单独的 Item ,专门用来管理其他 Item 的。后面介绍的几种布局,也是相似的。

Row 沿着一行安置它的孩子们。在你须要水平放置一系列的 Item 时。它比锚布局更加方便。一旦你把一个 Item 交给 Row 来管理。那就不要再使用 Item 的 x 、 y 、 anchors 等属性了。 Row 会安排得妥妥的。

在一个 Row 内的 item ,能够使用 Positioner 附加属性来获知自己在 Row 中的很多其他位置信息。 Positioner 有 index 、 isFirstItem 、 isLastItem 三个属性。

看我们的演示样例 row_layout.qml :

import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.centerIn: parent;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} Row {
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
spacing: 4; ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
}
}

运行命令 qmlscene row_layout.qml ,效果如图 4 所看到的:

图 4 行布局效果图

由于 Row 本身是一个 Item ,所以你能够使用锚布局来定位一个 Row 。演示样例中这么做了,把 Row 放在界面的左下角。

Row 有一个 spacing 属性,用来指定它管理的 Item 之间的间隔。

另一个 layoutDirection 属性,能够指定布局方向,取值为 Qt.LeftToRight 时从左到右放置 Item 。这是默认行为。取值为 Qt.RightToLeft 时从右向左放置 Item 。

还有其他的一些属性,请參看 Qt SDK 。

列布局

Column 与 Row 相似,只是是在垂直方向上安排它的子 Items 。

在你须要垂直放置一系列的 Item 时,它比锚布局更加方便。

Column 本身也是一个 Item ,能够使用 anchors 布局来决定它在父 Item 中的位置。 Column 的 spacing 属性描写叙述子 Item 之间的间隔。

看演示样例 column_layout.qml :

import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.centerIn: parent;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} Column {
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
spacing: 4; ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
}
}

代码与 row_layout.qml 相似,不用解释了。图 5 是运行 qmlscene column_layout.qml 后的效果:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZm9ydW9r/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

图 5 列布局效果图

与 Row 相似, Column 内的子 Item 也能够使用 Positioner 附加属性。

表格布局

Grid 在一个网格上安置它的子 Items 。它会创建一个拥有非常多单元格的网格。足够容纳它全部的子 Items 。 Grid 会从左到右、从上到下把它的子 items 一个一个塞到单元格里。

item 默认会被放在一个单元格左上角。(0,0) 位置。

你能够通过 rows 和 columns 属性设定表格的行、列数。假设你不设置,默认仅仅有四列。而行数则会依据实际的 item 数量自己主动计算。 rowSpacing 和 columnSpacing 指定行、列间距,单位是像素。

Grid 的 flow 属性描写叙述表格的流模式,能够取值 Grid.LeftToRight ,这是默认模式。从左到右一个挨一个放置 item ,一行放满再放下一行;取值为 Grid.TopToBottom 时,从上到下一个挨一个放置 item ,一列放满再放下一列。

horizontalItemAlignment 和 verticalItemAlignment 指定单元格对齐方式。默认的单元格对齐方式和 layoutDirection 以及 flow 有关。

先看个简单的样例, grid_layout.qml :

import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.centerIn: parent;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} Grid {
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
rows: 3;
columns: 3;
rowSpacing: 4;
columnSpacing: 4; ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
}
}

为了看出 flow 取值不同一时候的效果,我特意将行列数都设置为 3 ,创建了 7 个 ColorPicker 实例。图 6 是效果:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZm9ydW9r/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />

图 6 表格布局。从左到右的效果

假设设置 Grid 的 flow 属性为 Grid.TopToBottom (加一行代码 "flow: Grid.TopToBottom;"),能够看到图 7 的效果:

图 7 表格布局,从上到下的效果

调整 Grid 的其他属性会带来什么样的变化呢?请你试试吧。

流布局

Flow 事实上和 Grid 相似,不同之处是它没有显式的行、列数,它会计算自身尺寸和子 item 尺寸来依据须要折行。它的 flow 属性。默认取值 Flow.LeftToRight 。从左到右安排 item ,直到 Flow 本身的宽度被超出时折行。当 flow 取值 Flow.TopToBottom 时,从上到下安排 item ,直到 Flow 本身的高度被超出时開始在下一列上安排 item 。

spacing 属性描写叙述 item 之间的间隔。

看个演示样例, flow_layout.qml :

import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.horizontalCenter: parent.horizontalCenter;
anchors.top: parent.top;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} Flow {
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
width: 280;
height: 130;
spacing: 4; ColorPicker {
width: 80;
height: 20;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
width: 100;
height: 40;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
width: 80;
height: 25;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
width: 35;
height: 35;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
width: 20;
height: 80;
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
}
}

我改变了 ColorPicker 实例的大小。以便观察 Flow 布局的特点:依据自身宽高是否被 item 超出而自己主动折行。图 8 是 flow 为 LeftToRight (代码中未设置 flow 属性。默认值是 LeftToRight)时的效果:

图 8 流布局,从左到右效果

改动下代码,在 Flow 对象生命内加入 "flow: Flow.TopToBottom;" 这行代码,再次运行 qmlscene flow_layout.qml 。效果如图 9 所看到的:

图 9 流布局,从上到下效果

如你所见,效果大大不同。

事实上能够把流布局想象成英文文字排版系统。一个 item 相应一个单词,横版模式时,从左到右,一行一行安排单词的位置,当接近一行的宽度时,假设下一个单词摆上去就会超出行宽,那就把这个单词放到下一行上,继续排排排……。竖版模式也是相似的……或许你看过竖版书,非常easy理解这件事情。

常见布局介绍完了,在学习 Qt Widgets 的布局管理器时,我们知道布局能够嵌套,比方我常常拿 QVBoxLayout 和 QHBoxLayout 嵌套来完毕一些界面的布局。

那 Qt Quick 中的布局能否够嵌套呢?

嵌套布局

    Qt Quick 中布局是能够嵌套的。比方 Row 和 Column 能够相互嵌套来实现 Grid 布局的效果。

    看下 nested_layout.qml :
import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.centerIn: parent;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} Row {
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
spacing: 4; Column {
spacing: 4;
ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
} Column {
spacing: 4;
ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
} Column {
spacing: 4;
ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
}
}
}

我在一个 Row 内嵌套了 3 个 Column ,实现了 2x3 的表格布局。运行 qmlscene nested_layout.qml ,能够看到图 10 :

                图 10 Row 与 Column 嵌套
    嵌套时。比方放在 Row 内的 Column ,事实上对于 Row 来讲和其他非布局类的 item 一样,没什么差别。
    我们改动一下上面的代码,嵌套两个 Column 。让其他两个 ColorPicker 实例与 Column 处在同一层级。代码例如以下:
import QtQuick 2.0
import QtQuick.Controls 1.1 Rectangle {
width: 360;
height: 240;
color: "#EEEEEE";
id: rootItem; Text {
id: centerText;
text: "A Single Text.";
anchors.centerIn: parent;
font.pixelSize: 24;
font.bold: true;
} function setTextColor(clr){
centerText.color = clr;
} Row {
anchors.left: parent.left;
anchors.leftMargin: 4;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 4;
spacing: 4; Column {
spacing: 4;
ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
} Column {
spacing: 4;
ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
} //Column {
// spacing: 4;
ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
} ColorPicker {
color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1.0);
onColorPicked: setTextColor(clr);
}
//}
}
}

注意代码中我仅仅是把最后一个 Column 对象声明给凝视掉了,图 11 是运行效果:

                图 11 嵌套布局
    可能你想到了。锚布局无法和其他布局嵌套……你能够试一下。
    好啦。嵌套布局就介绍到这里,感兴趣的话请自行实验其他布局之间的嵌套效果。
    版权全部 foruok 。转载请注明出处:http://blog.csdn.net/foruok 。

回想一下:

版权声明:本文foruok原创文章,博客,未经同意不得转载。

Qt Quick 布局演示的更多相关文章

  1. Qt Quick 布局介绍

    在 Qt Quick 中有两套与布局管理相关的类库,一套叫作 Item Positioner(定位器),一套叫作 Item Layout(布局). 定位器包括 Row(行定位器).Column(列定位 ...

  2. Qt Quick实现的涂鸦程序

    之前一直以为 Qt Quick 里 Canvas 才干够自绘.后来发觉不是,原来还有好几种方式都能够画图! 能够使用原始的 OpenGL(Qt Quick 使用 OpenGL 渲染).能够构造QSGN ...

  3. Qt Quick 事件处理之信号与槽

    前面两篇文章<QML 语言基础>和<Qt Quick 简单教程>中我们介绍了 QML 语言的基本的语法和 Qt Quick 的常见元素,亲们,通过这两篇文章,您应该已经能够完毕 ...

  4. Qt Quick之StackView具体解释(1)

    Qt Quick中有个StackView.我在<Qt Quick核心编程>一书中没有讲到.近期有人问起,趁机学习了一下,把它的基本使用方法记录下来. 我准备分两次来讲.第一次讲主要的使用方 ...

  5. Qt Quick 图像处理实例之美图秀秀(附源代码下载)

    在<Qt Quick 之 QML 与 C++ 混合编程具体解释>一文中我们解说了 QML 与 C++ 混合编程的方方面面的内容,这次我们通过一个图像处理应用.再来看一下 QML 与 C++ ...

  6. Qt Quick综合实例之文件查看器

    假设你基于Qt SDK 5.3.1来创建一个Qt Quick App项目,项目模板为你准备的main.qml文档的根元素是ApplicationWindow或Window.这次我们就以Applicat ...

  7. Qt Quick 之 QML 与 C++ 混合编程具体解释

    Qt Quick 技术的引入.使得你能够高速构建 UI ,具有动画.各种绚丽效果的 UI 都不在话下.但它不是万能的.也有非常多局限性,原来 Qt 的一些技术,比方低阶的网络编程如 QTcpSocke ...

  8. Qt Quick 之 PathView 具体解释

    PathView ,顾名思义,沿着特定的路径显示 Model 内的数据. Model 能够是 QML 内建的 ListModel . XmlListModel ,也能够是在 C++ 中实现的 QAbs ...

  9. Qt Quick 事件处理之信号与槽(foruok的博客)

    前面两篇文章<QML 语言基础>和<Qt Quick 简单教程>中我们介绍了 QML 语言的基本语法和 Qt Quick 的常见元素,亲们,通过这两篇文章,您应该已经可以完成简 ...

随机推荐

  1. POJ1274 The Perfect Stall【二部图最大匹配】

    主题链接: id=1274">http://poj.org/problem? id=1274 题目大意: 有N头奶牛(编号1~N)和M个牛棚(编号1~M). 每头牛仅仅可产一次奶.每一 ...

  2. android 4.0 中出错 java.lang.UnsupportedOperationException

    在android4.0中  画图的时候使用: canvas.clipPath(path, Region.Op.XOR); 报错 java.lang.UnsupportedOperationExcept ...

  3. 部署IIS错误

  4. 2048 Puzzle游戏攻略

    2048 Puzzle这是目前手机游戏的很火. 在地铁上经常看到的人玩这个游戏. 首先,简介2048 Puzzle游戏. 游戏界面是4X4广场格,每一方格可以放置在数字. 有四种移动数字的方法,向左. ...

  5. Net Memory Profiler 分析.Net程序内存泄露

    Net Memory Profiler 分析.Net程序内存泄露 Haozes's Tech Space 人類的全部才能無非是時間和耐心的混合物 使用.Net Memory Profiler 分析.N ...

  6. SQLSERVER2014的内存优化表

    SQL Server 2014中的内存引擎(代号为Hekaton)将OLTP提升到了新的高度. 现在,存储引擎已整合进当前的数据库管理系统,而使用先进内存技术来支持大规模OLTP工作负载. 就算如此, ...

  7. MapReduce(十五): 从HDFS阅读本文的源代码分析

    以Map任务读取文本数据为例: 1)   LineRecordReader负责对文件切割的定位,以及对读取每一行内容的封装供用户Map任务使用.每次在定位在文件里不为0的位置时,多读取一行,由于前一个 ...

  8. freemarker错误九

    1.错误叙述性说明 五月 30, 2014 11:52:04 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template p ...

  9. 最短路径:Dijkstra,Bellman,SPFA,Floyd该算法的实施

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMzQ4NzA1MQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  10. hdu 1226 BFS + bfs记录路径

    http://acm.hdu.edu.cn/showproblem.php? pid=1226 为了节省空间.您可以使用vis初始化数组初始化-1. 发现BFSeasy错了地方 始一直WA在这里:就是 ...