void AbstractImageWriter::onFileChanged(const QString& fn) {
    m_reload_file = fn;
    if (m_reload_timer) {
        m_reload_timer->stop();
    } else {
        m_reload_timer = new QTimer(this);
        connect(m_reload_timer,SIGNAL(timeout()),this,SLOT(onReload()));
    }
    m_reload_timer->setSingleShot(true);
    m_reload_timer->setInterval(2000);
    m_reload_timer->start();

}
Exemple #2
0
// TODO now not support CJKs paths, why?
// TODO drop duplicate item in history vector
DirNavBar::DirNavBar(QWidget *parent)
    : QWidget(parent)
    ,uiw(new Ui::DirNavBar())
{
    this->uiw->setupUi(this);

    ////
    this->zoonSlider = NULL;

    this->dirHistoryCurrentPos = -1;
    this->comer = this->uiw->comboBox->completer();
    this->comer->setCompletionMode(QCompleter::PopupCompletion);
    this->comer->setMaxVisibleItems(32);
    this->comModel = new QStringListModel();
    this->comer->setModel(this->comModel);
    
    // on emit signal by key, not program setting
    QObject::connect(this->uiw->comboBox, SIGNAL(currentIndexChanged(const QString &)),
                     this, SLOT(onComboboxIndexChanged(const QString &)));
    QObject::connect(this->uiw->comboBox, SIGNAL(editTextChanged(const QString &)),
                     this, SLOT(onComboBoxEditTextChanged(const QString &)));
    QObject::connect(this->uiw->toolButton_5, SIGNAL(clicked()),
                     this, SLOT(onGoHome()));
    QObject::connect(this->uiw->toolButton_4, SIGNAL(clicked()),
                     this, SLOT(onGoPrevious()));
    QObject::connect(this->uiw->toolButton_3, SIGNAL(clicked()),
                     this, SLOT(onGoNext()));
    QObject::connect(this->uiw->toolButton_2, SIGNAL(clicked()),
                     this, SLOT(onGoUp()));
    QObject::connect(this->uiw->toolButton, SIGNAL(clicked()),
                     this, SLOT(onReload()));
    QObject::connect(this->uiw->toolButton_7, SIGNAL(clicked()),
                     this, SLOT(onDropDownZoonSlider()));

    this->uiw->comboBox->installEventFilter(this);

    this->maxHistoryCount = 100;
}