注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

沙漠里de烟雨

原创分享,禁止转载

 
 
 

日志

 
 

如何将QWidget等QtGui写成qml来调用  

2017-07-01 16:05:14|  分类: QT5.x与QML |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
因为qtgui与qml(opengl)不能混用于qml中,即qtgui注册的控件不能与Quick中的Item系共存,所以要实现如题
的功能,只能将Quick弃之。
关键代码:
Q_PROPERTY(Panel* panel READ panel)

Panel*  panel()
{
    int index = m_panelList.count();
    Panel* panel = new Panel(this);
    panel->setIndex(index);
    m_panelList.append(panel);
}
private:
    QList<Panel*>   m_panelList;

qmlRegisterType<Panel>("GUI", 1, 0, "Panel");


下面就把整个demo的代码帖上,在此之前,先贴张效果图
如何将QWidget等QtGui写成qml来调用 - 漠雨 - 沙漠里de烟雨
 
GuiToQml.pro ============>

#-------------------------------------------------
#
# Project created by QtCreator 2017-07-01T13:59:56
#
#-------------------------------------------------
QT += core gui quickwidgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = GuiToQml
TEMPLATE = app

CONFIG += c++11 console
DESTDIR = $$PWD/bin64

SOURCES += main.cpp\
        widget.cpp \
    attrview.cpp \
    button.cpp \
    menuview.cpp \
    panel.cpp \
    ribbon.cpp \
    sceneview.cpp \
    separator.cpp

HEADERS  += widget.h \
    attrview.h \
    button.h \
    customtabstyle.h \
    menuview.h \
    panel.h \
    ribbon.h \
    sceneview.h \
    enum.h \
    separator.h

DISTFILES += \
    bin64/qmls/main.qml


main.cpp ========>

#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include "widget.h"
#include "menuview.h"
#include "attrview.h"
#include "sceneview.h"
#include "customtabstyle.h"
#include "ribbon.h"
#include "panel.h"
#include "button.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    qmlRegisterType<Widget>("GUI", 1, 0, "Widget");

    qmlRegisterType<MenuView>("GUI", 1, 0, "MenuView");
    qmlRegisterType<CustomTabStyle>("GUI", 1, 0, "CustomTabStyle");
    qmlRegisterType<Ribbon>("GUI", 1, 0, "Ribbon");
    qmlRegisterType<Panel>("GUI", 1, 0, "Panel");
    qmlRegisterType<Button>("GUI", 1, 0, "Button");

    qmlRegisterType<AttrView>("GUI", 1, 0, "AttrView");
    qmlRegisterType<SceneView>("GUI", 1, 0, "SceneView");
    QQmlApplicationEngine engine;
    engine.load(QUrl::fromLocalFile("qmls/main.qml"));

    return a.exec();
}

attrview.h =======>

#ifndef ATTRVIEW_H
#define ATTRVIEW_H
#include <QWidget>
class AttrView : public QWidget
{
    Q_OBJECT
public:
    explicit AttrView(QWidget *parent = 0);
};

#endif // ATTRVIEW_H

attrview.cpp =======>

#include "attrview.h"
AttrView::AttrView(QWidget *parent) : QWidget(parent)
{
    this->setAutoFillBackground(true);
    QPalette pt(palette());
    pt.setColor(QPalette::Background,Qt::gray);
    this->setPalette(pt);
    this->show();
}


button.h ========>

#ifndef BUTTON_H
#define BUTTON_H

#include <QWidget>

class Button : public QWidget
{
    Q_OBJECT
    Q_ENUMS(Layout)
    Q_PROPERTY(int index READ index WRITE setIndex)
    Q_PROPERTY(int btnWidth READ btnWidth WRITE setBtnWidth)
    Q_PROPERTY(QString name READ name WRITE setName)
    Q_PROPERTY(int layout READ layout WRITE setBtnLayout)
public:
    explicit Button(QWidget *parent = 0);

protected:
    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);
    void paintEvent(QPaintEvent *event);
public:
    int index()const;
    void setIndex(int index);
    int btnWidth()const;
    void setBtnWidth(int width);
    QString name()const;
    void setName(const QString& name);
    int layout() const;
    void setBtnLayout(int layout);
public:
    enum Layout{Horizontal,Vertical};

private:
    void hoveredUpdate(bool hovered);
private:
    int         m_index;
    int         m_btnWidth;
    int         m_layout;
    QString     m_buttonName;
private:
    bool    m_hovered;
    bool    m_pressed;
};

#endif // BUTTON_H


button.cpp ======>

#include "button.h"

#include <QLabel>
#include <QLayout>
#include <QPaintEvent>
#include <QPainter>

#include "enum.h"

Button::Button(QWidget *parent) : QWidget(parent)
{
    this->resize(40,BtnHeight);

    QLabel* lab = new QLabel(this);
    lab->setText("select");
    lab->setAlignment(Qt::AlignCenter);
    lab->setStyleSheet("color:white");
    QVBoxLayout* layout = new QVBoxLayout;
    layout->addWidget(lab);
    this->setLayout(layout);

    m_hovered = false;
    m_pressed = false;
}

void Button::enterEvent(QEvent *event)
{
    this->hoveredUpdate(true);
    QWidget::enterEvent(event);
}

void Button::leaveEvent(QEvent *event)
{
    this->hoveredUpdate(false);
    QWidget::leaveEvent(event);
}
void Button::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
   // if(btnEnabled)
    {
        QLinearGradient linearGradient(0,0,0,height());
        linearGradient.setColorAt(0,QColor( (m_pressed?"#067e9e":(m_hovered?"#2e606e":BtnColor)) ));
        linearGradient.setColorAt(0.8,QColor( (m_pressed?"#296474":(m_hovered?"#3c575e":BtnColor)) ));
        linearGradient.setColorAt(1,QColor( (m_pressed?"#445155":(m_hovered?"#484e4f":BtnColor)) ));
        painter.setPen(Qt::transparent);
        painter.setBrush(linearGradient);
        painter.drawRect(0,0,width(),height());
    }

    QWidget::paintEvent(event);
}
int Button::index() const
{
    return m_index;
}

void Button::setIndex(int index)
{
    m_index = index;
}

int Button::btnWidth() const
{
    return m_btnWidth;
}

void Button::setBtnWidth(int width)
{
    m_btnWidth = width;
    resize(width,height());
}

QString Button::name() const
{
    return m_buttonName;
}

void Button::setName(const QString &name)
{
    m_buttonName = name;
}

int Button::layout() const
{
    return m_layout;
}


void Button::setBtnLayout(int layout)
{
    m_layout = layout;
}

void Button::hoveredUpdate(bool hovered)
{
    this->m_hovered = hovered;
  //  hovered ? this->showTooltip() : this->hideTooltip();
    update();

}

customtabstyle.h =====>

#ifndef CUSTOMTABSTYLE_H #define CUSTOMTABSTYLE_H #include <QPainter> #include <QProxyStyle> #include <QStyleHintReturn> #include "enum.h" class CustomTabStyle : public QProxyStyle { public: QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const { QSize sz = QProxyStyle::sizeFromContents(type,option,size,widget); if(type == QStyle::CT_TabBarTab) { int rw = sz.width(); sz.transpose(); sz.rwidth() = rw + 10; sz.rheight() = TabBarHeight; } return sz; } void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const { if(element == CE_TabBarTabLabel) { if(const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { QRect rect = tab->rect; int top_gap = 2; int top_radius = 5; int bottom_gap = 6; //==bottom_radius; if(tab->state & QStyle::State_Selected) //clicked or double clicked; { painter->setPen(Qt::black); painter->setBrush(QBrush(Qt::gray)); QPainterPath path; int x0 = rect.x(); int y0 = rect.y()+rect.height(); path.moveTo(x0,y0); x0 = rect.x()-bottom_gap; y0 = rect.y()+rect.height()-2*bottom_gap; path.arcTo(x0,y0,2*bottom_gap,2*bottom_gap,270,90); //270指当前所在角度,90指逆时针转90度,若为负,则为顺时针; x0 += 2*bottom_gap; y0 = rect.y()+top_gap+top_radius; path.lineTo(x0,y0); y0 = rect.y()+top_gap; path.arcTo(x0,y0,2*top_radius,2*top_radius,180,-90); x0 += top_radius; // path.moveTo(x0,y0); x0 = rect.x()+rect.width()-bottom_gap-top_radius; path.lineTo(x0,y0); x0 -= top_radius; path.arcTo(x0,y0,2*top_radius,2*top_radius,90,-90); x0 += 2*top_radius; y0 += top_radius; // path.moveTo(x0,y0); y0 = rect.y()+rect.height()-bottom_gap; path.lineTo(x0,y0); y0 -= bottom_gap; path.arcTo(x0,y0,2*bottom_gap,2*bottom_gap,180,90); // path.moveTo(rect.x()+rect.width(),rect.y()+rect.height()); path.lineTo(rect.x(),rect.y()+rect.height()); painter->drawPath(path); } else if(tab->state & QStyle::State_MouseOver) //mouse hovered; { painter->setPen(Qt::black); int x0 = rect.x()+bottom_gap; int y0 = rect.y()+rect.height(); int x1 = x0; int y1 = rect.y()+top_gap; painter->drawLine(x0,y0,x1,y1); x0 = x1; y0 = y1; x1 = rect.x()+rect.width()-bottom_gap; painter->drawLine(x0,y0,x1,y1); x0 = x1; y0 = y1; y1 = rect.y()+rect.height(); painter->drawLine(x0,y0,x1,y1); } QTextOption option; option.setAlignment(Qt::AlignCenter); painter->drawText(rect, tab->text,option); return ; } } if(element == CE_TabBarTab) { // if(const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) // { // QRect rect = tab->rect; // qDebug() << rect << endl; // } QProxyStyle::drawControl(element,option,painter,widget); } if(element == CE_TabBarTabShape) { return ; } } }; #endif // CUSTOMTABSTYLE_H


enum.h =====>

#ifndef ENUM_H #define ENUM_H enum enumHeight { TabBarHeight = 25, BtnArryHeight = 75, PanelTitleHeigt = 20, RibbonHeight = BtnArryHeight+PanelTitleHeigt, MenuBarHeight = TabBarHeight+RibbonHeight }; enum enumSeparator { SeparatorGap = 5, SeparatorWidth = 2, SeparatorHeight = RibbonHeight-2*SeparatorGap }; enum enumBtnGap { BtnGap=5, TopGap=5, BtnHeight=BtnArryHeight-TopGap }; enum enumLayout { Horizontal, Vertical, }; enum enumBtnType { CustomType, //自定义; PressType, //按压式开关; ContactType, //接触式开关;按下后会弹起; SeparateMenuType, //分离式(与弹出式菜单按钮分开); IntegratedMenuType //整合式(与弹出式菜单按钮在一块); }; #define HoveredBtnColor "#30606c" #define BtnColor "#00000000" #define PanelColor "#404040" #define HoveredPanelColor "#4c4c4c" #endif // ENUM_H


menuview.h ======>

#ifndef MENUVIEW_H
#define MENUVIEW_H

#include <QTabWidget>

class Ribbon;
class MenuView : public QTabWidget
{
    Q_OBJECT
    Q_PROPERTY(Ribbon* ribbon READ ribbon)
public:
    explicit MenuView(QWidget *parent = 0);

public slots:
    void nameChanged(int index,const QString& name);

public:
    Q_INVOKABLE void appendTab(Ribbon* ribbon,const QString& name);
public:
    Ribbon *ribbon();


};

#endif // MENUVIEW_H


menuview.cpp =======>

#include "menuview.h"

#include <QTabBar>
#include "customtabstyle.h"
#include "ribbon.h"

MenuView::MenuView(QWidget *parent) : QTabWidget(parent)
{
    this->setFixedHeight(MenuBarHeight);
    this->tabBar()->setStyle(new CustomTabStyle);
   // m_completed = false;
}

void MenuView::nameChanged(int index,const QString &name)
{
    this->tabBar()->setTabText(index,name);
}

void MenuView::appendTab(Ribbon *ribbon, const QString &name)
{
    this->addTab(ribbon,name);
}

Ribbon *MenuView::ribbon()
{
    int index = this->count();
    Ribbon* ribbon = new Ribbon(this);
    ribbon->setIndex(index);
    this->addTab(ribbon,"");
    return ribbon;
}


panel.h ========>

#ifndef PANEL_H
#define PANEL_H

#include <QWidget>

class QLabel;
class Separator;
class Button;
class Panel : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(int panelWidth READ panelWidth WRITE setPanelWidth)
    Q_PROPERTY(int index READ index WRITE setIndex)
    Q_PROPERTY(QString name READ name WRITE setName)
    Q_PROPERTY(Button* button READ button)
public:
    explicit Panel(QWidget *parent = 0);

protected:
    void resizeEvent(QResizeEvent *event);
    void paintEvent(QPaintEvent* event);
    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);
public:
    int panelWidth() const;
    void setPanelWidth(int width);
    int index()const;
    void setIndex(int index);
    QString name()const;
    void setName(const QString& name);
    Button* button();

private:
    void reLayout();
private:
    int m_panelWidth;
    int m_index;
private:
    QColor      m_bkColor;
    QString     m_panelName;
    QLabel*     m_panelTitle;
    Separator*  m_separator;
private:
    QList<Button*>  m_buttonList;
};

#endif // PANEL_H


panel.cpp =====>

#include "panel.h"

#include <QLabel>
#include <QDebug>

#include "enum.h"
#include "separator.h"
#include "button.h"


Panel::Panel(QWidget *parent) : QWidget(parent)
{
    this->setFixedHeight(RibbonHeight);
    this->setMinimumWidth(20);
    this->setAutoFillBackground(true);

    m_bkColor = QColor(PanelColor);

    m_panelTitle = new QLabel(this);
    m_panelTitle->setStyleSheet("color:white;font:bold");
    m_panelTitle->setFixedHeight(PanelTitleHeigt);
    m_panelTitle->setAlignment(Qt::AlignHCenter|Qt::AlignTop);
    m_separator = new Separator(this);
}

void Panel::resizeEvent(QResizeEvent *event)
{
    reLayout();
    m_panelTitle->setGeometry(0,height()-PanelTitleHeigt,width(),PanelTitleHeigt);
    m_separator->move(m_panelWidth,SeparatorGap);
    QWidget::resizeEvent(event);
}

void Panel::paintEvent(QPaintEvent *event)
{
    QPalette pt(this->palette());
    pt.setColor(QPalette::Background,m_bkColor);
    this->setPalette(pt);
    QWidget::paintEvent(event);
}

void Panel::enterEvent(QEvent *event)
{
    m_bkColor = QColor(HoveredPanelColor);
    update();
    QWidget::enterEvent(event);
}

void Panel::leaveEvent(QEvent *event)
{
    m_bkColor = QColor(PanelColor);
    update();
    QWidget::leaveEvent(event);
}

int Panel::panelWidth() const
{
    return m_panelWidth;
}

void Panel::setPanelWidth(int width)
{
    m_panelWidth = width;
    this->resize(width+SeparatorWidth,height());
}

int Panel::index() const
{
    return m_index;
}

void Panel::setIndex(int index)
{
    m_index = index;
}

QString Panel::name() const
{
    return m_panelName;
}

void Panel::setName(const QString &name)
{
    m_panelName = name;
    m_panelTitle->setText(name);
}

Button *Panel::button()
{
    int index = m_buttonList.count();
    Button* button = new Button(this);
    button->setIndex(index);
    m_buttonList.append(button);
    reLayout();
    return button;
}

void Panel::reLayout()
{
    int x0 = BtnGap;
    int y0 = TopGap;
    int firstIndexInCurVertical = -1; //当前垂直布局中的起始index;
    for(int i=0;i<m_buttonList.count();i++)
    {
        Button* btn = m_buttonList[i];
        int layout = btn->layout();
        if(layout == Horizontal) //水平布局时,直接加入;
        {
            btn->move(x0,y0);
            x0 += btn->width()+BtnGap;
            firstIndexInCurVertical = -1;
        }
        else //if(layout == Vertical) //垂直布局时,分情况;
        {
            if(i==0     //第一个为垂直布局类型时;
              || m_buttonList[i-1]->layout() == Horizontal)    //当前btn的前一个btn的布局类型为水平布局时;
            { //直接加入;
                btn->move(x0,y0);
                x0 += btn->width()+BtnGap;
                firstIndexInCurVertical = i; //记录当前垂直布局的位置;
            }
            else //当前btn的布局类型为垂直布局且前面至少还有一个btn的布局类型为垂直布局且在同一个垂直布局组中,此时重新调整这个垂直布局组中所有btn的高度--将高度均分,并从上至下依次排列好;
            {
                int verticalBtnCount = i-firstIndexInCurVertical+1; //当前垂直布局中按钮的个数;
                if(verticalBtnCount<=3)
                {
                    int verticalBtnAvgHeight = BtnHeight/verticalBtnCount; //当前垂直布局中按钮平均高度;
                    int xpos = m_buttonList[firstIndexInCurVertical]->x();//当有垂直布局中第一个按钮的x位置;
                    int ypos = TopGap;
                    for(int j=firstIndexInCurVertical;j<firstIndexInCurVertical+verticalBtnCount;j++)
                    {
                        QWidget* vBtn = m_buttonList[j];
                        vBtn->setGeometry(xpos,ypos,vBtn->width(),verticalBtnAvgHeight);
                        ypos += verticalBtnAvgHeight;
                    }
                }
                else //超过3行,另起一列;
                {
                    btn->move(x0,y0);
                    x0 += btn->width()+BtnGap;
                    firstIndexInCurVertical = i;
                }
            }
        }
    }
}


ribbon.h =======>

#ifndef RIBBON_H #define RIBBON_H #include <QWidget> class Panel; class Ribbon : public QWidget { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(int index READ index WRITE setIndex) Q_PROPERTY(Panel* panel READ panel) public: explicit Ribbon(QWidget *parent=0); protected: void resizeEvent(QResizeEvent *event); signals: void nameChanged(int index,const QString& name); public: QString name() const; void setName(const QString& name); int index() const; void setIndex(int index); Panel* panel(); private: QString m_name; int m_index; private: QList<Panel*> m_panelList; }; #endif // RIBBON_H


ribbon.cpp ========>

#include "ribbon.h"

#include <QDebug>

#include "enum.h"
#include "panel.h"

Ribbon::Ribbon(QWidget *parent) : QWidget(parent)
{
    this->setVisible(false);
    this->setAutoFillBackground(true);
    QPalette pt(this->palette());
    pt.setBrush(QPalette::Background,QBrush(PanelColor));
    this->setPalette(pt);

    connect(this,SIGNAL(nameChanged(int,QString)),parent,SLOT(nameChanged(int,QString)));
}

void Ribbon::resizeEvent(QResizeEvent *event)
{
    int x0 = 0;
    for(int i=0;i<m_panelList.count();i++)
    {
        m_panelList[i]->move(x0,0);
        x0 += m_panelList[i]->width();
    }

    QWidget::resizeEvent(event);
}

QString Ribbon::name() const
{
    return m_name;
}

void Ribbon::setName(const QString &name)
{
    m_name = name;
    emit nameChanged(m_index,name);
}

int Ribbon::index() const
{
    return m_index;
}

void Ribbon::setIndex(int index)
{
    m_index = index;
}

Panel *Ribbon::panel()
{
    int index = m_panelList.count();
    Panel* panel = new Panel(this);
    panel->setIndex(index);
    m_panelList.append(panel);
    //强制更新;
    resize(width()+1,height());
    resize(width()-1,height());
    return panel;
}

sceneview.h =====>

#ifndef SCENEVIEW_H #define SCENEVIEW_H #include <QWidget> class SceneView : public QWidget { Q_OBJECT public: explicit SceneView(QWidget *parent = 0); signals: public slots: }; #endif // SCENEVIEW_H


sceneview.cpp ======>

#include "sceneview.h" SceneView::SceneView(QWidget *parent) : QWidget(parent) { this->setMinimumWidth(300); this->setAutoFillBackground(true); QPalette pt(palette()); pt.setColor(QPalette::Background,Qt::blue); this->setPalette(pt); this->show(); }


separator.h ========>

#ifndef SEPARATOR_H #define SEPARATOR_H #include <QWidget> class Separator : public QWidget { Q_OBJECT public: explicit Separator(QWidget *parent = 0); protected: void paintEvent(QPaintEvent* event); }; #endif // SEPARATOR_H



separator.cpp =========>

#include "separator.h" #include <QPaintEvent> #include <QPainter> #include "enum.h" Separator::Separator(QWidget *parent) : QWidget(parent) { this->setFixedSize(SeparatorWidth,SeparatorHeight-5); //-5修正; } void Separator::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setBrush(QColor(Qt::white)); painter.drawRect(0,0,width(),height()); QWidget::paintEvent(event); }


widget.h ========>

#ifndef WIDGET_H #define WIDGET_H #include <QWidget> class MenuView; class TreeView; class AttrView; class SceneView; class Widget : public QWidget { Q_OBJECT Q_PROPERTY(int winWidth READ winWidth WRITE setWinWidth NOTIFY winWidthChanged) Q_PROPERTY(int winHeight READ winHeight WRITE setWinHeight NOTIFY winHeightChanged) Q_PROPERTY(MenuView* menuView READ menuView) Q_PROPERTY(AttrView* attrView READ attrView) Q_PROPERTY(SceneView* sceneView READ sceneView) public: Widget(QWidget *parent = 0); ~Widget(); signals: void winWidthChanged(); void winHeightChanged(); public: int winWidth()const; void setWinWidth(int width); int winHeight()const; void setWinHeight(int height); MenuView* menuView(); TreeView* treeView(); AttrView* attrView(); SceneView* sceneView(); private: int m_winWidth; int m_winHeight; private: MenuView* m_menuView; TreeView* m_treeView; AttrView* m_attrView; SceneView* m_sceneView; }; #endif // WIDGET_H


widget.cpp =========>

#include "widget.h" #include <QSplitter> #include <QLayout> #include "menuview.h" #include "attrview.h" #include "sceneview.h" Widget::Widget(QWidget *parent) : QWidget(parent) { QSplitter* splitter = new QSplitter(Qt::Horizontal,this); splitter->setStretchFactor(1,1); splitter->show(); m_menuView = new MenuView(this); m_attrView = new AttrView(splitter); m_sceneView = new SceneView(splitter); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(m_menuView); layout->addWidget(splitter); layout->setSpacing(0); this->setLayout(layout); } Widget::~Widget() { } int Widget::winWidth() const { return m_winWidth; } void Widget::setWinWidth(int width) { m_winWidth = width; resize(width,height()); emit winWidthChanged(); } int Widget::winHeight() const { return m_winHeight; } void Widget::setWinHeight(int height) { m_winHeight = height; resize(width(),height); emit winWidthChanged(); } MenuView *Widget::menuView() { return m_menuView; } AttrView *Widget::attrView() { return m_attrView; } SceneView *Widget::sceneView() { return m_sceneView; }


main.qml ======>

import GUI 1.0 import "." Widget { id: root visible: true winWidth: 800 winHeight: 600 menuView { id: menu ribbon { id: tools name: "Tools" visible: true } ribbon { id: view name: "View" visible: true } ribbon { id: navigation name: "Navigation" visible: true } ribbon { id: effects name: "Effects" visible: true } ribbon { id: analysis name: "Analysis" visible: true } ribbon { id: layers name: "Layers" visible: true } ribbon { id: objects name: "Objects" visible: true } ribbon { id: home name: "Home" visible: true panel { id: naviagation name: "Navigation" panelWidth: 135 visible: true } panel { id: environment name: "Environment" panelWidth: 135 visible: true } panel { id: selection name: "Selection" panelWidth: 135 visible: true button { id: paste name: "Paste" btnWidth: 65 layout: Button.Horizontal visible: true } button { id: select name: "Select" btnWidth: 65 layout: Button.Horizontal visible: true } } } } attrView { id: attr } sceneView { id: scene } }

备注: main.qml中,ribbon, panel, button的创建顺序都是一样的,都是从下往上逐个创建,现仍不解,如故若有哪位看客
客知晓其缘由,烦请回复,在下先行谢过。

  评论这张
 
阅读(36)| 评论(0)
推荐

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017