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

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();
    

    }

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型