Original post

Hi. I’m trying to learn how to use Qt in . I am working my way through a book that uses C++ examples that I’m trying to translate into . I’m stuck at QKeySequences.

Will someone point me in the right direction? My computer runs ubuntu 18.04.

Thanks

For the record: You use https://therecipe.github.io/qt/

Can you show us a small sample of the code that you are having problems with?

MainWindow::MainWindow()
{
setWindowTitle(“SRM System”);
setFixedSize(500, 500);
QPixmap newIcon(“new.png”);
QPixmap openIcon(“open.png”);
QPixmap closeIcon(“close.png”);
// Setup File Menu
fileMenu = menuBar()->addMenu(“&File”);
quitAction = new QAction(closeIcon, “Quit”, this);
quitAction->setShortcuts(QKeySequence::Quit);
newAction = new QAction(newIcon, “&New”, this);
newAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
openAction = new QAction(openIcon, “&New”, this);
openAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
fileMenu->addAction(newAction);
fileMenu->addAction(openAction);
fileMenu->addSeparator();
fileMenu->addAction(quitAction);
helpMenu = menuBar()->addMenu(“Help”);
aboutAction = new QAction(“About”, this);
aboutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
helpMenu->addAction(aboutAction);
// Setup Signals and Slots
connect(quitAction, &QAction::triggered, this, &QApplication::quit);
}

There are four usages of QKeySequence in this C++ code.

How do you port it to Go? Does it work?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.