当前位置: 首页>>代码示例>>C++>>正文


C++ QMdiSubWindow::setGeometry方法代码示例

本文整理汇总了C++中QMdiSubWindow::setGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ QMdiSubWindow::setGeometry方法的具体用法?C++ QMdiSubWindow::setGeometry怎么用?C++ QMdiSubWindow::setGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMdiSubWindow的用法示例。


在下文中一共展示了QMdiSubWindow::setGeometry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateSubWindow


//.........这里部分代码省略.........

    if (WindowExists(name, parent) == true)
        return -1;

    qDebug() << "Creating new subwindow type " << type << " name " << name;

    IWin *s;

    if ((type >= WT_DCCSEND) && (type <= WT_DCCCHAT)) {
        IConnection *c = conlist.value(parent, NULL);
        s = new IWin(ui->mdiArea, name, type, &conf, &scriptParent, c);

        parent = 0;
    }
    else
        s = new IWin(ui->mdiArea, name, type, &conf, &scriptParent);

    IConnection *connection = conlist.value(parent, NULL);
    if (type == WT_STATUS) {
        qDebug() << "Window is status, new connection added with id " << s->getId();
        connection = new IConnection(this, &chanlist, s->getId(), &conf, &scriptParent, &wsw);
        connection->setActiveInfo(&activeWname, &activeConn);
        connect(connection, SIGNAL(connectionClosed()),
                this, SLOT(connectionClosed()));
        connect(connection, SIGNAL(connectedToIRC()),
                this, SLOT(connectionEstablished()));
        connect(connection, SIGNAL(RequestTrayMsg(QString,QString)),
                this, SLOT(trayMessage(QString,QString)));
    }

    qDebug() << "Connection added, setting pointers";

    s->setConnectionPtr(connection);
    if (connection != NULL)
        s->setSortRuleMap(connection->getSortRuleMapPtr());

    qDebug() << "Pointers set, setting up mdiSubWindow";

    QMdiSubWindow *previous = ui->mdiArea->currentSubWindow();
    QMdiSubWindow *sw = ui->mdiArea->addSubWindow(s, Qt::SubWindow);

    qDebug() << "Pointer to subwindow: " << sw;

    qDebug() << "Icon...";

    // Add icon to window
    QString ico = ":/window/gfx/custom.png"; // Default to this.
    if (type == WT_PRIVMSG)
      ico = ":/window/gfx/query.png";
    if (type == WT_CHANNEL)
      ico = ":/window/gfx/channel.png";
    if (type == WT_STATUS)
      ico = ":/window/gfx/status.png";
    sw->setWindowIcon(QIcon(ico));

    qDebug() << "Treeitem...";

    QTreeWidgetItem *treeitem = GetWidgetItem(parent);

    if (treeitem == NULL)
        treeitem = new QTreeWidgetItem(ui->treeWidget);
    else
        treeitem = new QTreeWidgetItem(treeitem);


    treeitem->setIcon(0, QIcon(ico));
    treeitem->setText(0, name);
    treeitem->setToolTip(0, name);

    qDebug() << "subwindow_t instance...";

    subwindow_t wt;
    wt.connection = connection;
    wt.parent = parent;
    wt.subwin = sw;
    wt.treeitem = treeitem;
    wt.type = type;
    wt.wid = s->getId();
    wt.widget = s;
    wt.highlight = HL_NONE;

    qDebug() << "Adding subwindow_t to winlist...";

    winlist.insert(s->getId(), wt);

    wsw.addWindow(type, name, wt.wid, parent);

    sw->setGeometry(0, 0, 500, 400);

    if (type == WT_STATUS) {
        qDebug() << "Adding connection to the list...";
        // The Connection class ID is the exact same ID as the status window ID.
        conlist.insert(s->getId(), connection);
        treeitem->setExpanded(true);
        connection->addWindow("STATUS", wt);
        connect(connection, SIGNAL(RequestWindow(QString,int,int,bool)),
                this, SLOT(CreateSubWindow(QString,int,int,bool)));
        connect(connection, SIGNAL(HighlightWindow(int,int)),
                this, SLOT(Highlight(int,int)));
    }
开发者ID:Tomatix,项目名称:IdealIRC,代码行数:101,代码来源:idealirc.cpp


注:本文中的QMdiSubWindow::setGeometry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。