void MainWindow::init(){ mainSplitter = new MySplitter(Qt::Horizontal); mainSplitter->setHandleWidth(4); mLeftPanel = new QTableWidget(this); mLeftPanel->setColumnCount(4); mLeftPanel->setColumnWidth(0,120); mLeftPanel->setColumnWidth(1,120); mLeftPanel->setColumnWidth(2,200); mLeftPanel->setColumnWidth(3,300); QStringList header; header<<"Author"<<"Email"<<"Date"<<"Sha1"; mLeftPanel->setHorizontalHeaderLabels(header); mLeftPanel->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); mLeftPanel->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); mLeftPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mLeftPanel->setSelectionMode(mLeftPanel->SingleSelection); mLeftPanel->setSelectionBehavior(mLeftPanel->SelectRows); mRightPanel = new QWidget(); mRightPanelLayout = new QVBoxLayout(); mRightPanelLayout->setMargin(0); mRightPanel->setLayout(mRightPanelLayout); mRightPanel->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); mRightPanel->setContentsMargins(0,1,0,0); mRightPanelCommit = new QTextEdit(); mRightPanelCommit->setMinimumHeight(80); mRightPanelCommit->setMaximumHeight(80); mRightPanelCommit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); mRightPanelCommit->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // mRightPanelCommit->setReadOnly(true); mRightPanelEdit = new QTextEdit(); mRightPanelEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); mRightPanelEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); mRightPanelEdit->setWordWrapMode(QTextOption::NoWrap); // mRightPanelEdit->setReadOnly(true); mRightPanelLayout->addWidget(mRightPanelCommit); mRightPanelLayout->addWidget(mRightPanelEdit); mainSplitter->addWidget(mLeftPanel); mainSplitter->addWidget(mRightPanel); mainSplitter->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); mainSplitter->setStretchFactor(0, 0); mainSplitter->setStretchFactor(1, 1); mainSplitter->widget(0)->setMinimumWidth(600); mainSplitter->setOpaqueResize(true); this->setCentralWidget(mainSplitter); this->setPath(this->runCmd("realpath",QStringList()<<".")); connect(mLeftPanel,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChange())); }
void tab::createConnects() { connect(urlAddress, SIGNAL(returnPressed()), this, SLOT(newUrl())); connect(addressCompleter, SIGNAL(itemChoosed(QString)), this, SLOT(newUrl(QString))); connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl))); connect(webView, SIGNAL(titleChanged(QString)), this, SLOT(chTitle(QString))); connect(webView, SIGNAL(iconChanged()), this, SLOT(chIcon())); connect(webView, SIGNAL(statusBarMessage(QString)), this, SLOT(statusBarMessage(QString))); connect(webView, SIGNAL(selectionChanged()), this, SLOT(selectionChange())); connect(webView, SIGNAL(loadStarted()), this, SLOT(loadStart())); connect(webView, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int))); connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinish(bool))); connect(webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClick(QUrl))); connect(webView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequest(QPoint))); connect(webView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(downloadRequest(QNetworkReply*))); connect(webView->page(), SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequset(QNetworkRequest))); connect(webView->page(), SIGNAL(printRequested(QWebFrame*)), this, SLOT(printPage(QWebFrame*))); }
ParameterEdit::ParameterEdit(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) { setupUi(this); _list->hide(); // parameter lists come from document definitions, so are only visible after a call to setDocument() _list->setDisabled(true); _edit->setDisabled(true); // signals and slots connections connect(_cancel, SIGNAL(clicked()), this, SLOT(reject())); connect(_ok, SIGNAL(clicked()), this, SLOT(accept())); connect(_new, SIGNAL(clicked()), this, SLOT(newItem())); connect(_edit, SIGNAL(clicked()), this, SLOT(edit())); connect(_list, SIGNAL(clicked()), this, SLOT(editItemList())); connect(_delete, SIGNAL(clicked()), this, SLOT(deleteItem())); connect(_table, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(doubleClick(int, int))); connect(_table, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChange())); }
ParameterEdit::ParameterEdit(QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl) { setupUi(this); // OK and Cancel are only appropriate if the widget is a stand-alone window if (parent) { _ok->hide(); _cancel->hide(); _buttonDiv->hide(); } _list->hide(); // parameter lists come from document definitions, so are only visible after a call to setDocument() _list->setDisabled(true); _edit->setDisabled(true); connect(_new, SIGNAL(clicked()), this, SLOT(newItem())); connect(_edit, SIGNAL(clicked()), this, SLOT(edit())); connect(_list, SIGNAL(clicked()), this, SLOT(editItemList())); connect(_delete, SIGNAL(clicked()), this, SLOT(deleteItem())); connect(_table, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(doubleClick(int, int))); connect(_table, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChange())); }