Functions::Functions( char angleMode, QObject * parent ) : QObject( parent ), d( new Functions::Private ) { d->p = this; setAngleMode( angleMode ); d->createBuiltInFunctions(); retranslateText(); }
void UserFunctionListWidget::changeEvent(QEvent* event) { if (event->type() == QEvent::LanguageChange) { setLayoutDirection(Qt::LeftToRight); retranslateText(); return; } QWidget::changeEvent(event); }
void ConstantsWidget::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { Constants::instance()->retranslateText(); retranslateText(); } else QWidget::changeEvent(e); }
BookDock::BookDock(const QString &path, const QString &homePage, QWidget *parent) : QDockWidget(parent) , m_file(homePage) , m_homePage(homePage) , m_language(Settings::instance()->language) , m_path(path) { QWidget *widget = new QWidget(this); QVBoxLayout *bookLayout = new QVBoxLayout; m_browser = new QTextBrowser(this); m_browser->setLineWrapMode(QTextEdit::NoWrap); m_browser->setSearchPaths(QStringList() << m_path); connect(m_browser, SIGNAL(anchorClicked(const QUrl &)), SLOT(handleAnchorClick(const QUrl &))); m_buttonLayoutWidget = new QWidget; m_buttonLayout = new QHBoxLayout(m_buttonLayoutWidget); m_buttonLayout->setSpacing(0); m_buttonLayout->setMargin(0); m_backButton = new QPushButton("", this); m_backButton->setIcon(QPixmap(":/book_back.png")); m_backButton->setFlat(true); connect(m_backButton, SIGNAL(clicked()), m_browser, SLOT(backward())); connect(m_browser, SIGNAL(backwardAvailable(bool)), m_backButton, SLOT(setEnabled(bool))); m_buttonLayout->addWidget(m_backButton); m_forwardButton = new QPushButton("", this); m_forwardButton->setIcon(QPixmap(":/book_forward.png")); m_forwardButton->setFlat(true); connect(m_forwardButton, SIGNAL(clicked()), m_browser, SLOT(forward())); connect(m_browser, SIGNAL(forwardAvailable(bool)), m_forwardButton, SLOT(setEnabled(bool))); m_buttonLayout->addWidget(m_forwardButton); m_indexButton = new QPushButton("", this); m_indexButton->setIcon(QPixmap(":/book_home.png")); m_indexButton->setFlat(true); connect(m_indexButton, SIGNAL(clicked()), SLOT(openHomePage())); m_buttonLayout->addWidget(m_indexButton); m_buttonLayout->addStretch(); bookLayout->addWidget(m_buttonLayoutWidget); bookLayout->addWidget(m_browser); widget->setLayout(bookLayout); setWidget(widget); retranslateText(); }
void BookDock::changeEvent(QEvent *event) { if (event->type() == QEvent::LanguageChange) retranslateText(); else if (event->type() == QEvent::LayoutDirectionChange) handleLayoutDirection(); else QDockWidget::changeEvent(event); }
void VariablesWidget::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { setLayoutDirection(Qt::LeftToRight); retranslateText(); } else QWidget::changeEvent(e); }
int Functions::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: retranslateText(); break; default: ; } _id -= 1; } return _id; }
VariablesWidget::VariablesWidget(ItemPolicy itemPolicy, QWidget *parent) : QWidget(parent) , m_filterTimer(new QTimer(this)) , m_itemPolicy(itemPolicy) , m_variables(new QTreeWidget(this)) , m_noMatchLabel(new QLabel(m_variables)) , m_searchFilter(new QLineEdit(this)) , m_searchLabel(new QLabel(this)) { m_filterTimer->setInterval(500); m_filterTimer->setSingleShot(true); m_variables->setAlternatingRowColors(true); m_variables->setAutoScroll(true); m_variables->setColumnCount(2); m_variables->setEditTriggers(QTreeWidget::NoEditTriggers); m_variables->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_variables->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); m_variables->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_variables->setRootIsDecorated(false); m_variables->setSelectionBehavior(QTreeWidget::SelectRows); m_variables->setCursor(QCursor(Qt::PointingHandCursor)); m_noMatchLabel->setAlignment(Qt::AlignCenter); m_noMatchLabel->adjustSize(); m_noMatchLabel->hide(); QWidget *searchBox = new QWidget(this); QHBoxLayout *searchLayout = new QHBoxLayout; searchLayout->addWidget(m_searchLabel); searchLayout->addWidget(m_searchFilter); searchLayout->setMargin(0); searchBox->setLayout(searchLayout); QVBoxLayout *layout = new QVBoxLayout; layout->setMargin(3); layout->addWidget(searchBox); layout->addWidget(m_variables); setLayout(layout); retranslateText(); connect(m_filterTimer, SIGNAL(timeout()), SLOT(fillTable())); connect(m_searchFilter, SIGNAL(textChanged(const QString &)), SLOT(triggerFilter())); connect(m_variables, SIGNAL(itemActivated(QTreeWidgetItem *, int)), SLOT( catchItemActivated(QTreeWidgetItem *, int))); connect(m_variables, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), SLOT(catchItemDoubleClicked(QTreeWidgetItem *, int))); }
UserFunctionListWidget::UserFunctionListWidget(QWidget* parent) : QWidget(parent) , m_filterTimer(new QTimer(this)) , m_userFunctions(new QTreeWidget(this)) , m_noMatchLabel(new QLabel(m_userFunctions)) , m_searchFilter(new QLineEdit(this)) , m_searchLabel(new QLabel(this)) { m_filterTimer->setInterval(500); m_filterTimer->setSingleShot(true); m_userFunctions->setAlternatingRowColors(true); m_userFunctions->setAutoScroll(true); m_userFunctions->setColumnCount(2); m_userFunctions->setEditTriggers(QTreeWidget::NoEditTriggers); m_userFunctions->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_userFunctions->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); m_userFunctions->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_userFunctions->setRootIsDecorated(false); m_userFunctions->setSelectionBehavior(QTreeWidget::SelectRows); m_userFunctions->setCursor(QCursor(Qt::PointingHandCursor)); m_noMatchLabel->setAlignment(Qt::AlignCenter); m_noMatchLabel->adjustSize(); m_noMatchLabel->hide(); QWidget* searchBox = new QWidget(this); QHBoxLayout* searchLayout = new QHBoxLayout; searchLayout->addWidget(m_searchLabel); searchLayout->addWidget(m_searchFilter); searchLayout->setMargin(0); searchBox->setLayout(searchLayout); QVBoxLayout* layout = new QVBoxLayout; layout->setMargin(3); layout->addWidget(searchBox); layout->addWidget(m_userFunctions); setLayout(layout); QMenu* contextMenu = new QMenu(m_userFunctions); m_insertAction = new QAction("", contextMenu); m_editAction = new QAction("", contextMenu); m_deleteAction = new QAction("", contextMenu); m_deleteAllAction = new QAction("", contextMenu); m_userFunctions->setContextMenuPolicy(Qt::ActionsContextMenu); m_userFunctions->addAction(m_insertAction); m_userFunctions->addAction(m_editAction); m_userFunctions->addAction(m_deleteAction); m_userFunctions->addAction(m_deleteAllAction); QWidget::setTabOrder(m_searchFilter, m_userFunctions); retranslateText(); connect(m_filterTimer, SIGNAL(timeout()), SLOT(fillTable())); connect(m_searchFilter, SIGNAL(textChanged(const QString&)), SLOT(triggerFilter())); connect(m_userFunctions, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(activateItem())); connect(m_insertAction, SIGNAL(triggered()), SLOT(activateItem())); connect(m_editAction, SIGNAL(triggered()), SLOT(editItem())); connect(m_deleteAction, SIGNAL(triggered()), SLOT(deleteItem())); connect(m_deleteAllAction, SIGNAL(triggered()), SLOT(deleteAllItems())); }
ConstantsWidget::ConstantsWidget(QWidget *parent) : QWidget(parent) { m_categoryLabel = new QLabel(this); m_category = new QComboBox(this); m_category->setEditable(false); m_category->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); connect(m_category, SIGNAL(activated(int)), SLOT(filter())); QWidget *categoryBox = new QWidget(this); QHBoxLayout *categoryLayout = new QHBoxLayout; categoryBox->setLayout(categoryLayout); categoryLayout->addWidget(m_categoryLabel); categoryLayout->addWidget(m_category); categoryLayout->setMargin(0); m_label = new QLabel(this); m_filter = new QLineEdit(this); m_filter->setMinimumWidth(fontMetrics().width('X') * 10); connect(m_filter, SIGNAL(textChanged(const QString &)), SLOT(triggerFilter())); QWidget *searchBox = new QWidget(this); QHBoxLayout *searchLayout = new QHBoxLayout; searchBox->setLayout(searchLayout); searchLayout->addWidget(m_label); searchLayout->addWidget(m_filter); searchLayout->setMargin(0); m_list = new QTreeWidget(this); m_list->setAutoScroll(true); m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_list->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); m_list->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_list->setColumnCount(3); m_list->setRootIsDecorated(false); m_list->setMouseTracking(true); m_list->setEditTriggers(QTreeWidget::NoEditTriggers); m_list->setSelectionBehavior(QTreeWidget::SelectRows); m_list->setAlternatingRowColors(true); m_list->setCursor(QCursor(Qt::PointingHandCursor)); connect(m_list, SIGNAL(itemActivated(QTreeWidgetItem *, int)), SLOT(handleItem(QTreeWidgetItem *))); QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); layout->setMargin(3); layout->addWidget(categoryBox); layout->addWidget(searchBox); layout->addWidget(m_list); m_filterTimer = new QTimer(this); m_filterTimer->setInterval(500); m_filterTimer->setSingleShot(true); connect(m_filterTimer, SIGNAL(timeout()), SLOT(filter())); m_noMatchLabel = new QLabel(this); m_noMatchLabel->setAlignment(Qt::AlignCenter); m_noMatchLabel->adjustSize(); m_noMatchLabel->hide(); retranslateText(); }