예제 #1
0
CloudView::CloudView(QWidget *parent)
    : QWidget(parent),
      in_refresh_(false),
      list_repo_req_(NULL)
{
    repos_list_ = new ServerReposListView;
    repos_model_ = new ServerReposListModel;
    repos_list_->setModel(repos_model_);

    createLoadingView();

    QStackedLayout *stack = new QStackedLayout;
    stack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack->insertWidget(INDEX_REPOS_LIST, repos_list_);
    setLayout(stack);

    prepareAccountButtonMenu();

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshRepos()));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(setCurrentAccount(const Account&)));

    connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
            this, SLOT(updateAccountMenu()));

    connect(seafApplet->accountManager(), SIGNAL(accountRemoved(const Account&)),
            this, SLOT(updateAccountMenu()));
}
static PyObject *meth_QStackedLayout_insertWidget(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        int a0;
        QWidget* a1;
        PyObject *a1Wrapper;
        QStackedLayout *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "Bi@J8", &sipSelf, sipType_QStackedLayout, &sipCpp, &a0, &a1Wrapper, sipType_QWidget, &a1))
        {
            int sipRes = 0;

#line 74 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtGui/qstackedlayout.sip"
        Py_BEGIN_ALLOW_THREADS
        sipCpp->insertWidget(a0, a1);
        Py_END_ALLOW_THREADS
        
        // The layout's parent widget (if there is one) will now have ownership.
        QWidget *parent = sipCpp->parentWidget();
        
        if (parent)
        {
            PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
            
            if (py_parent)
                sipTransferTo(a1Wrapper, py_parent);
        }
        else
        {
            // For now give the Python ownership to the layout.  This maintains
            // compatibility with previous versions and allows insertWidget(QWidget()).
            sipTransferTo(a1Wrapper, sipSelf);
        }
#line 704 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtGui/sipQtGuiQStackedLayout.cpp"

            return SIPLong_FromLong(sipRes);
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QStackedLayout, sipName_insertWidget, doc_QStackedLayout_insertWidget);

    return NULL;
}
예제 #3
0
void ScriptToolbox::layoutStackedInsertWidget(QObject * obj, int index, QWidget * widget)
{
  QStackedLayout * layout = qobject_cast<QStackedLayout*>(obj);
  if(layout && widget)
    layout->insertWidget(index, widget);
}