新浪微博
腾讯微博
会员列表
统计排行
基本信息
到访IP统计
管理团队
管理统计
在线会员
会员排行
版块排行
帖子排行
标签排行
帮助
下拉
用户名
电子邮箱
用户名
密 码
记住登录
登录
找回密码
注册
快捷通道
关闭
您还没有登录,快捷通道只有在登录后才能使用。
立即登录
还没有帐号? 赶紧
注册一个
首页
论坛
Qt下载
作品展
群组
个人中心
捐赠、管理与开发
邮件订阅
帖子
文章
日志
用户
版块
群组
帖子
搜索
QTCN开发网
>
Qt QML开发
>
GridView位置怎么样设定
发帖
回复
返回列表
新帖
3234
阅读
1
回复
[提问]
GridView位置怎么样设定
[复制链接]
上一主题
下一主题
离线
xuekew
UID:184876
注册时间
2017-09-20
最后登录
2018-01-15
在线时间
14小时
发帖
7
搜Ta的帖子
精华
0
金钱
70
威望
17
贡献值
0
好评度
7
访问TA的空间
加好友
用道具
新手上路
关闭
个人中心可以申请新版勋章哦
立即申请
知道了
加关注
发消息
只看楼主
倒序阅读
楼主
发表于: 2017-09-25
如题,下面是我的代码
复制代码
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.0
//
Item {
id:homeRoot;
anchors.fill:parent;
Rectangle{
id:top_Rectangle;
width:mainRoot.width;
height:35*dpi;
color:"red";
Image{
id:navi_qrcode;
width:25*dpi;
height:25*dpi;
anchors.top:parent.top;
anchors.topMargin:5*dpi;
anchors.left:parent.left;
anchors.leftMargin:10*dpi;
source: "qrc:/new/prefix1/icon_navi_qrcode_new.png";
MouseArea{
anchors.fill:parent;
focus: true;
onClicked:{
//扫一扫被点击
}
}
}
Rectangle{
id:search;
width:(parent.width/6)*4;
height:(parent.height/3)*2;
anchors.left:navi_qrcode.right;
anchors.leftMargin: 5*dpi;
anchors.top:parent.top;
anchors.topMargin:(parent.height/3)*0.5;
color:"#eef1f4";
radius:10*dpi;
Image{
id:top_search;
width:12*dpi;
height:12*dpi;
anchors.top:parent.top;
anchors.topMargin:6*dpi;
anchors.left:parent.left;
anchors.leftMargin:5*dpi;
source:"qrc:/new/prefix1/icon_navigation_search.png";
}
Text{
text:"请输入搜索内容";
anchors.left:top_search.right;
anchors.leftMargin:8*dpi;
anchors.top:parent.top;
anchors.topMargin:2*dpi;
font.pixelSize: 14*dpi;
color:"#7f7f80";
}
Component.onCompleted: {
console.log(height);
}
}
Rectangle{
width:(parent.width/6)*2;
height:parent.height;
anchors.left:search.right;
color:"red";
Image{
source: "qrc:/new/prefix1/icon_navi_im_new.png";
anchors.left:parent.left;
anchors.leftMargin: parent.width/10;
anchors.top:parent.top;
anchors.topMargin:5*dpi;
width:navi_qrcode.width;
height:navi_qrcode.height;
}
}
}
ListModel{
id:lsitmode;
ListElement{
title:"WIFI"
}
ListElement{
title:"签证"
}
ListElement{
title:"自由行"
}
ListElement{
title:"自由行"
}
ListElement{
title:"自由行"
}
ListElement{
title:"自由行"
}ListElement{
title:"自由行"
}
}
Component{
id:warper;
RowLayout{
Text{
text:title;
anchors.fill:parent;
anchors.top:parent.bottom;
}
}
}
GridView {
width: 180; cellHeight: 10
anchors.fill: parent
model: lsitmode;
delegate: warper
focus: true
}
}
共
条评分
回复
举报
分享到
淘江湖
新浪
QQ微博
QQ空间
开心
人人
豆瓣
网易微博
百度
鲜果
白社会
飞信
离线
自强不吸
UID:149314
注册时间
2014-02-12
最后登录
2020-08-04
在线时间
345小时
发帖
214
搜Ta的帖子
精华
0
金钱
2192
威望
227
贡献值
2
好评度
216
访问TA的空间
加好友
用道具
侠客
加关注
发消息
只看该作者
1楼
发表于: 2017-09-26
给他加个父item 然后设置父item的位置
共
条评分
自强不吸!
回复
举报
发帖
回复
返回列表
http://www.qtcn.org/bbs
访问内容超出本站范围,不能确定是否安全
继续访问
取消访问
快速回复
限100 字节
您目前还是游客,请
登录
或
注册
进入高级模式
文字颜色
发 布
回复后跳转到最后一页
上一个
下一个
关闭
补充发布信息
验证码:
发 布
隐藏
快速跳转
站务及资讯
网站公告
新闻资讯
Qt官方发布
网站管理
Qt应用及资源
Qt 作品展
Qt代码秀
Qt应用版
Qt技术讨论区
Qt安装与发布
Qt中文处理
Qt基础编程
Qt QML开发
Qt嵌入式开发
Qt移动平台开发
其它技术开发讨论区
Qt图书专区
《C++ GUI Qt 4编程》(第2版)专栏
《Qt高级编程》专栏
《零基础学Qt4编程》专栏
《Qt设计模式》(第2版) 图书专栏
Python Qt GUI快速编程
Qt项目开发区
天池项目
Qt开放平台开发库
机械CAD
扇贝词典
非活跃项目区
社区中心
帖子回收站(Trash)
招聘、求职、供求、广告等
休闲娱乐
关闭
关闭
选中
1
篇
全选