c++ - How to move string from QTextEdit to another QTextEdit using pushButton in Qt? -


i using 2 text edit , 2 push buttons in between them. objective list out files particular folder in first qtextedit implemented successfully. want select particular file(s) , send them second qtextedit using pushbutton in between them , in case, want delete file(s) reverse should happen second pushbutton.

the following sample code of mainwindow.cpp:::

#include "mainwindow.h" #include "ui_mainwindow.h" #include <qfiledialog> #include <qdebug> #include <qdiriterator> #include <qtextedit> #include <qtextcursor> #include <qtextcharformat> #include <qwidget> #include <qstring>   qstring dirpath;  mainwindow::mainwindow(qwidget *parent) :     qmainwindow(parent), ui(new ui::mainwindow) {     ui->setupui(this);      connect(ui->pushbrowse,signal(clicked()),this,slot(pushbrowseclicked()));     connect(ui->pushadd,signal(clicked()),this,slot(pushaddclicked));  }  mainwindow::~mainwindow() {     delete ui; }  void mainwindow::pushbrowseclicked() {     dirpath = qfiledialog::getexistingdirectory(this,"choose directory","/home",              qfiledialog::showdirsonly);     qdebug()<<dirpath;      ui->textbrowse->settext(dirpath);     display_button_target_files(dirpath); }  void mainwindow::display_button_target_files(qstring dirpath) {     qdebug()<<"[display_button_target_files]";     qdebug()<<dirpath;      int filecount = 0;      qdiriterator it(dirpath);      ui->textdisplay->clear();      while (it.hasnext())     {         it.next();         qfileinfo fi = it.fileinfo();          if (fi.isfile())        {             qdebug()<<it.filename();             ui->textdisplay->append(it.filename());             filecount++;        }    }   qdebug() << "total file count: " + qstring::number(filecount);   } 


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -