qq594987822 2015-06-03 08:21 采纳率: 0%
浏览 3413

qml-的-Rectangle的窗口显示不出来

Rectangle{
    id: saving;
    width: 470;
    height: 50;
    radius: 5
    anchors.left: parent.left

// x: 0;
// y: -217
z: 5;
visible: false
color: "lightgrey"
MouseArea{
anchors.fill: parent.fill;
}
Text{
anchors.horizontalCenter: parent.horizontalCenter;
anchors.verticalCenter: parent.verticalCenter;
text: qsTr("saving image ...");
color: "white"
font.pixelSize: 30;
}
}

Rectangle{
    id: photo_save_rect;

    width: 86;
    height: 36
    anchors.bottom: parent.bottom;
    radius: 5;
    color: "transparent"
    BorderImage{
        id: photo_save_rect_image;
        anchors.fill: parent;
        source:  "./res/setting_image/down.png"
    }
    MouseArea{
        anchors.fill: parent;
        onPressed: {
            console.log( "onPressed");
            photo_save_rect_image.source = "./res/setting_image/down_pressed.png";
        }
        onReleased: {
            saving.visible = true;
            for( i = 0; i < 5000; i ++ ){
                for( j = 0; j < 2500; j ++ ){
                }
            }
            saving.visible = false;
            photo_save_rect_image.source = "./res/setting_image/down.png"
        }
    }
}
  • 写回答

2条回答 默认 最新

  • one-rabbit 2020-03-19 09:40
    关注

    在main 中 修改为这样 把window 换成rectangle 就可以了

    ```#include
    int main(int argc, char *argv[])
    {
    QGuiApplication app(argc,argv);

    QQuickView viewer;
    
    viewer.setResizeMode(QQuickView::SizeRootObjectToView);
    viewer.setSource(QUrl("qrc:///main.qml"));
    viewer.show();
    return app.exec();
    

    }

    评论

报告相同问题?

悬赏问题

  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥15 python天天向上类似问题,但没有清零
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?