//Metoda monitorująca zmiany w plikach void MainWindow::Monitoruj_plik(QString Filename) // <- constructor { fw = new QFileSystemWatcher(this); connect( fw, SIGNAL(fileChanged(QString)), this, SLOT( fileChangedSlot(QString)) ); // <- never emit // connect( fw, SIGNAL(directoryChanged(QString)), this, SLOT( fileChangedSlot(QString)) ); //emit but files() is empty, directories() is ok fw->addPath(Filename); //qDebug() << fw->files() << fw->directories(); // outputs: () ("plik") in test ther are file //QMessageBox::information(this,"test","Zmiana pliku: "+Filename); }
Prueba::Prueba(QObject* parent) : QObject(parent) , _calendar( new KCalCore::MemoryCalendar( KDateTime::UTC )){ // QObject::connect(&this->_watcher, SIGNAL(fileChanged(QString)), this, SIGNAL(fileChanged())); QObject::connect(&this->_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChangedSlot(QString))); m_customColorScheme["sorpi"] = 3; m_customColorScheme.insert("longa", "poronga"); // CalendarToDo* c; // QString* sumario; // for(int i = 0; i < 3; i++){ // c = new CalendarToDo(parent); // sumario = new QString(); // *sumario = QString("sarasa %1").arg(i); // c->setSummary(*sumario); // c->setPriority(i * 2); // c->setPercentCompleted(i * 20); // this->listToDos.append(c); // } // QString* pp = new QString("VARIABLE SIN CAMBIAR"); // this->setUri(*pp); // this->setLonga(*pp); // QString longa // this->setLonga(c->summary()); }
views.append(new EditAreaTabWidget(mainForm, this)); views.append(new EditAreaTabWidget(mainForm, this)); foreach (EditAreaTabWidget *view, views) { view->setVisible(false); connect(view, SIGNAL(currentChanged(int)), this, SIGNAL(currentChanged())); connect(view, SIGNAL(currentChanged(int)), this, SLOT(checkViewStatus())); connect(view, SIGNAL(currentChanged(int)), this, SLOT(updateCurrentTabWidget())); connect(view, SIGNAL(moveToOtherView(int)), this, SLOT(moveToOtherViewSlot(int))); connect(view, SIGNAL(cloneToOtherView(int)), this, SLOT(cloneToOtherViewSlot(int))); connect(view, SIGNAL(focused()), this, SLOT(updateCurrentTabWidget())); mainSplitter->addWidget(view); } fileWatcher = new QFileSystemWatcher(this); connect(fileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChangedSlot(QString))); newFileId = 0; currentTabWidget = NULL; } MarkdownEditAreaWidget* EditAreaTabWidgetManager::addMarkdownEditAreaWidget( const QString &filePath, const QUrl &baseUrl, int id) { return addMarkdownEditAreaWidget(getCurrentTabWidget(), filePath, baseUrl, id); } MarkdownEditAreaWidget* EditAreaTabWidgetManager::addMarkdownEditAreaWidget( EditAreaTabWidget *view, const QString &filePath, const QUrl &baseUrl, int id) { //we assume file is exist or file path is empty(new file) MarkdownEditAreaWidget *newMEAW = new MarkdownEditAreaWidget(mainForm, filePath, baseUrl);