背景とアイコンにいくつかの画像を使用するアプリケーション (Qt Creator を使用) を開発しました。今、私はそれを展開しようとしています.アプリケーションは正常にインストールされています:
$ make
$ sudo make install
インストール ディレクトリは/usr/local/ctimer/
で、バイナリは にあり/usr/local/ctimer/ctimer
ます。問題は、たとえば Alt + F2 を使用してプログラムを実行すると/usr/local/ctimer/ctimer
、画像が表示されないことです。
そのフォルダーからプログラムを実行すると、すべて正常に動作することに気付きました。
$ cd /usr/local/ctimer/
$ ./ctimer
上記のコマンドを含む bash スクリプトを使用して問題を回避し、/usr/local/bin/
たとえばそれを配置することは可能ですが、この動作の理由を知りたいです。
何か案が?
編集:
コードは次のとおりです。
void Stopwatch::createMenu()
{
startAction = new QAction(QIcon("pictures/start.png"), tr("&Start/Continue"), this);
startAction->setToolTip("Start/Continue stopwatch");
startAction->setShortcut(Qt::CTRL + Qt::Key_S);
connect(startAction, SIGNAL(triggered()), this, SLOT(start()));
pauseAction = new QAction(QIcon("pictures/pause.png"), tr("&Pause"), this);
pauseAction->setToolTip("Pause stopwatch");
pauseAction->setShortcut(Qt::CTRL + Qt::Key_P);
connect(pauseAction, SIGNAL(triggered()), this, SLOT(pause()));
resetAction = new QAction(QIcon("pictures/reset.png"), tr("&Reset"), this);
resetAction->setToolTip("Reset stopwatch");
resetAction->setShortcut(Qt::CTRL + Qt::Key_C);
connect(resetAction, SIGNAL(triggered()), this, SLOT(reset()));
countDownAction = new QAction(QIcon("pictures/down.png"), tr("&Countdown"), this);
countDownAction->setToolTip("Create a custom count down");
countDownAction->setShortcut(Qt::CTRL + Qt::Key_D);
connect(countDownAction, SIGNAL(triggered()),
countDownDialog, SLOT(show()));
aboutAction = new QAction(QIcon("pictures/about.png"), tr("&About"), this);
aboutAction->setToolTip("About this timer!");
aboutAction->setShortcut(Qt::CTRL + Qt::Key_H);
connect(aboutAction, SIGNAL(triggered()), aboutDialog, SLOT(show()));
quitAction = new QAction(QIcon("pictures/quit.png"), tr("&Quit"), this);
quitAction->setToolTip("Quit timer!");
quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
contextMenu = new QMenu(this);
contextMenu->addAction(startAction);
contextMenu->addAction(pauseAction);
contextMenu->addAction(resetAction);
contextMenu->addAction(countDownAction);
contextMenu->addAction(aboutAction);
contextMenu->addAction(quitAction);
this->addAction(startAction);
this->addAction(pauseAction);
this->addAction(resetAction);
this->addAction(countDownAction);
this->addAction(aboutAction);
this->addAction(quitAction);
}