• 3967阅读
  • 4回复

哎。。。。又遇到问题了?新建的BUTTON控件不显示字??? [复制链接]

上一主题 下一主题
离线lovexin109
 

只看楼主 倒序阅读 楼主  发表于: 2014-07-15
建了一个QML登陆界面,里面建了一个loadButton按钮,在load_in界面里引用了这个按钮,Text却不显示,又新建了一个 quick UI 把loadbutton程序拷进去,却能显示字体,不知道问题出在哪里??
loadbutton.qml
import QtQuick 2.2

Rectangle {
    width: 162
    height: 38


    Image {
        id:loadbutton
   anchors.centerIn: parent//居中
   width:162
   height: 38
   smooth:true
   source:"image/load/button_login_normal.png"
}

    Text{
        anchors.centerIn: parent
        text:qsTr("load in")
        smooth: false
        antialiasing: false
        clip: false
        font.bold: true
        style: Text.Normal
        font.family: "Arial"
        font.pixelSize: 17
    }
}
load_in.qml
import QtQuick 2.2
import QtQuick.Controls 1.1

ApplicationWindow {
    visible: true
    width: 376
    height: 293
    title: qsTr("For mysql")
    Item{
         id:loadin_png
         width:  84
         height: 84
         anchors.centerIn: parent//居中
         anchors.verticalCenterOffset: 35
         anchors.horizontalCenterOffset: -119
         children: [
             Image{
                 anchors.centerIn: parent
                 width:84
                 height: 84
                // smooth:true
                 source: "image/load/image5.png"
             },

             Image {
            anchors.centerIn: parent//居中
            width:64
            height: 64
            smooth:true
            source:"image/load/image0.jpg"
        }

]
    }

Rectangle{
    id:passinput
    opacity:1
    width:  180
    height: 84
    color: "#00000000"  //可以 透明
    border.width: 0
    clip: false
    anchors.verticalCenter: loadin_png.verticalCenter
    anchors.left: loadin_png.right
    anchors.leftMargin: 10
    children: [
         ComboBox {
        id: name_in
        anchors.top:passinput.top
        anchors.topMargin: 10
        width: 180
        height: 25
        smooth: true
        clip: false
        activeFocusOnPress: false
                  },
        TextField{
            id:pass_in
            anchors.bottom: passinput.bottom
            anchors.bottomMargin: 10
            width:180
            height: 25
            font.pixelSize: 14
            placeholderText:qsTr("password in")
            echoMode: TextInput.Password
            inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
        }
    ]
}
LoadButton{
    anchors.centerIn: parent
    anchors.verticalCenterOffset: 110
}
}

离线toby520

只看该作者 1楼 发表于: 2014-07-16
使用button为什么不用QML自带的Button 里面还可以设置样式的,
QtQML多多指教开发社区 http://qtclub.heilqt.com
将QtCoding进行到底
关注移动互联网,关注金融
开发跨平台客户端,服务于金融行业
专业定制界面
群号:312125701   373955953(qml控件定做)
离线lovexin109

只看该作者 2楼 发表于: 2014-07-16
其实,我是想在这个button里做鼠标划过更换图片,所以就新建了一个
离线lovexin109

只看该作者 3楼 发表于: 2014-07-16
回 toby520 的帖子
toby520:使用button为什么不用QML自带的Button 里面还可以设置样式的, (2014-07-16 09:22) 

程序估计没错,今天运行就显示了,晕QML。。。。。。这 个还要重启电脑。。。。。谢谢版主
离线toby520

只看该作者 4楼 发表于: 2014-07-21
告诉你加载qml文件的是 如果是调试的时候就加载相对路径,不要加qrc 如果加入了qrc就可能导致qml文件没有即时生效 也可以说是没有编译进去,所以调试试验相对路径,改改qml某个文件 会即时生效,有qrc有重新编译可以看懂最新修改的
QtQML多多指教开发社区 http://qtclub.heilqt.com
将QtCoding进行到底
关注移动互联网,关注金融
开发跨平台客户端,服务于金融行业
专业定制界面
群号:312125701   373955953(qml控件定做)
快速回复
限100 字节
 
上一个 下一个