Statistik: Verfasst von Maeve785 — Gestern 20:38
Statistik: Verfasst von niladri11 — 24. März 2024 20:05
Statistik: Verfasst von Cyntcher — 22. März 2024 03:50
Statistik: Verfasst von Grieko — 15. Februar 2024 19:10
Code:
connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed(Qbject*)));connect(sender, SIGNAL(destroyed(QObject*)), this, SLOT(objectDestroyed()));connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed()));
Code:
connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed(QObject*)));
Statistik: Verfasst von helmut.jakoby — 15. Februar 2024 17:59
Code:
private slots: void updateMessage(const QMqttMessage &mqttMsg);private: Ui::MainWindow *ui; QMqttClient *m_client; QMqttSubscription *sub;
Code:
// Subscripe Button wurde gedruecktvoid MainWindow::on_pushButton_3_clicked(){ QMqttTopicFilter f; f.setFilter("HF02//#"); sub = m_client->subscribe(f); if (!sub) { QMessageBox::critical(this, "Error","Could not subscribe. Is there a valid connection?"); return; } else { connect (sub, &QMqttSubscription::messageReceived, this, &MainWindow::updateMessage); QMessageBox::information(this,"Message","Subscription successfull"); }}
Code:
void MainWindow::updateMessage(const QMqttMessage &mqttMsg){ ui->listWidget->addItem (mqttMsg.payload());}
Statistik: Verfasst von Grieko — 15. Februar 2024 17:02
Statistik: Verfasst von qtued — 19. Januar 2024 11:01
Statistik: Verfasst von 1sambha — 14. Januar 2024 08:57
Code:
qApp->progressEvents()
Statistik: Verfasst von dieter_ — 7. Januar 2024 15:05
Code:
connect( MyCalculateThread, SIGNAL( signal_calculated( int ) ), this, SLOT( showValue( int ) ) );
Code:
emit this->signal_calculated( wert);
Statistik: Verfasst von helmut.jakoby — 5. Januar 2024 08:09
Code:
ldt_file ->setText(QString::number(file_zaehler));
Statistik: Verfasst von dieter_ — 3. Januar 2024 18:54
Statistik: Verfasst von maliya1 — 27. Dezember 2023 15:22
Statistik: Verfasst von helmut.jakoby — 23. Dezember 2023 20:42
Code:
befehl = "mkdir " + folder;if(system (befehl.toUtf8().data())) befehl = "";
Statistik: Verfasst von dieter_ — 23. Dezember 2023 18:43
Code:
std::stringtoStdString() conststd::u16stringtoStdU16String() conststd::u32stringtoStdU32String() conststd::wstringtoStdWString() constQByteArraytoUtf8() constqsizetypetoWCharArray(wchar_t *array) const
Statistik: Verfasst von helmut.jakoby — 23. Dezember 2023 08:04
Code:
QString befehl,folder;folder = "~/Schreibtisch/Währung";//qDebug() << "folder verzeichnisse_anlegen" << folder;befehl = "mkdir " + folder;if(system (befehl.toLatin1().data())) befehl = "";
Code:
file:///home/dieter/Schreibtisch/W%E4hrung
Statistik: Verfasst von dieter_ — 22. Dezember 2023 13:15
Statistik: Verfasst von Diyan77 — 22. Dezember 2023 06:37
Statistik: Verfasst von Pacemaker — 15. Dezember 2023 10:13
Statistik: Verfasst von helmut.jakoby — 9. Dezember 2023 10:50
Statistik: Verfasst von Nukleus — 29. November 2023 12:48
Statistik: Verfasst von Nukleus — 29. November 2023 12:18
Statistik: Verfasst von Schleifchen — 5. November 2023 10:13
Statistik: Verfasst von Pacemaker — 24. Oktober 2023 13:36
Code:
QLabel * Label1;
Code:
Label1->setText("abcd");
Statistik: Verfasst von helmut.jakoby — 19. Oktober 2023 14:29
Statistik: Verfasst von aliye01 — 17. Oktober 2023 15:33
Statistik: Verfasst von Pacemaker — 13. Oktober 2023 16:27
Statistik: Verfasst von Aurelia — 30. September 2023 16:30
Statistik: Verfasst von Netzschleicher — 28. August 2023 18:08
Statistik: Verfasst von Marki — 13. Juli 2023 11:57
Code:
plot.axisWidget(QwtPlot::xBottom)->setMinBorderDist();
Code:
#include <cstdlib>#include <QApplication>#include <QTimer>#include "qwt_plot.h"#include "qwt_plot_curve.h"#include "qwt_scale_widget.h"int main (int argc, char* argv[]){ QApplication app(argc, argv); QwtPlot plot; plot.setTitle( "Plot Demo" ); plot.setCanvasBackground( Qt::white ); // hilft, aber dafür hat die Linie einen unschönen Abstand // plot.axisWidget(QwtPlot::xBottom)->setMinBorderDist(200, 200); class ScaleDraw : public QwtScaleDraw { private: QwtText label (double) const override { return QwtText("xxxxxxxxxxxxxxx"); } }; plot.setAxisScaleDraw(QwtPlot::xBottom, new ScaleDraw); const auto curve = new QwtPlotCurve; curve->setTitle("Some Points"); curve->setPen( Qt::blue, 4); curve->setRenderHint(QwtPlotItem::RenderAntialiased, true); QPolygonF points; std::srand(std::time(nullptr)); const auto random_variable = std::rand(); for (uint64_t x = 0; x != 10'000; ++x) { const auto y = static_cast<double>(std::rand()) / RAND_MAX * 1'000.0; points << QPointF(x, y); } curve->setSamples( points ); curve->attach(&plot); QTimer timer; timer.setInterval(50); QObject::connect(&timer, &QTimer::timeout, [&plot] { static uint64_t left = 0, right = 300; plot.setAxisScale(QwtPlot::xBottom, left, right); plot.replot(); left += 1; right += 1; }); timer.start(); plot.showMaximized(); return app.exec();}
Statistik: Verfasst von cz123 — 6. Juli 2023 08:58
Statistik: Verfasst von Marki — 21. Juni 2023 09:03
Statistik: Verfasst von pekoll123 — 31. Mai 2023 11:32
Statistik: Verfasst von ManLa — 24. Mai 2023 16:16
Statistik: Verfasst von mgottschalk — 12. Mai 2023 13:58
Statistik: Verfasst von Chri — 11. Mai 2023 14:58
Code:
#include <QSound>#include <QAudioOutput>#include <QDir>#include <QCoreApplication>{ QAudioOutput device(QAudioDeviceInfo::defaultOutputDevice()); QString homePath = QDir::homePath(); if (play_) { QSound::play(binPath + "/sounds/1.wav"); }}
Code:
#include <QSoundEffect>#include <QAudioOutput>#include <QMediaDevices>#include <QAudioDevice>#include <QDir>#include <QCoreApplication>{ QAudioDevice info(QMediaDevices::defaultAudioOutput()); QString homePath = QDir::homePath(); if (play_) { QSoundEffect effect; effect.setSource(QUrl::fromLocalFile(binPath + "/sounds/1.wav")); effect.play(); }}
Code:
#include <QSoundEffect>#include <QAudioOutput>#include <QMediaDevices>#include <QAudioDevice>#include <QAudioSink>#include <QDir>#include <QCoreApplication>{ QAudioDevice device(QMediaDevices::defaultAudioOutput()); QString binPath = QCoreApplication::applicationDirPath(); QString homePath = QDir::homePath(); QAudioFormat format; format.setSampleRate(8000); format.setChannelCount(1); format.setSampleFormat(QAudioFormat::UInt8); QAudioSink* audio = new QAudioSink(format, this); connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); if (play_) { QFile effect; effect.setFileName(binPath + "/sounds/1.wav"); effect.open(QIODevice::ReadOnly); audio->start(&effect); }}
Statistik: Verfasst von u640 — 16. April 2023 17:07
Code:
void MainWindow::on_pushButton_3_clicked() {QWidget* lab1=nullptr;lab1=new QWidget(this,Qt::Dialog);lab1->setWindowTitle("Importierte ...-Datei");lab1->showMaximized();myScene*scn=new myScene(lab1,&Formen);myGraphicsView* view=new myGraphicsView(scn,lab1);view->setMouseTracking(1);lab1->setMouseTracking(1);}
Code:
#ifndef MYSCENE_H#define MYSCENE_H#include <QGraphicsScene>#include <QPointF>#include "myStructs.h"#include "qdebug.h"#include <QLabel>#include <QPen>class myScene:public QGraphicsScene{private: struct forms *Fo=new struct forms; struct line *L= new struct line; std::vector<struct forms>*vecFptr=new std::vector<struct forms>; std::vector<struct line>*vecLptr=new std::vector<struct line>; std::vector<struct line>LINES; QVector<QPointF>QPoints; QVector<qreal>QPointsx; QVector<qreal>QPointsy;public: float xmin=1000000.0,ymin=1000000.0; float xmax=0.0,ymax=0.0; int numLines=0; int numPoints=0; QGraphicsScene *scene=nullptr; QWidget* w=nullptr; QLabel *lab=nullptr; std::vector<struct forms>* _F=nullptr; //KonstruktormyScene(QWidget* parent=nullptr, std::vector<struct forms> *F=nullptr):QGraphicsScene(parent){_F=F;w=new QWidget(parent,Qt::Dialog);w->setMouseTracking(1);scene=new QGraphicsScene(this->w);//Zeiger auf Vektor selbstthis->vecFptr=F;qDebug()<<F->size();//Zeiger auf Formenthis->Fo=&*F->begin();//Zeiger auf Linienzugthis->vecLptr=&F->at(0).Linienzug;//Zeiger auf Linienthis->L=&F->at(0).Linienzug[0];//Ermittlung Anzahl Linien numLinesint imax=(int)vecFptr->size();numLines=0;int _lineCount=0;for (int i=0;i<imax;i++){ this->vecLptr=&F->at(i).Linienzug; for(int j=0;j<(unsigned int)vecLptr->size();j++){ this->L=&F->at(i).Linienzug[j]; _lineCount++; LINES.resize(_lineCount); LINES[_lineCount-1].Number=L->Number; LINES[_lineCount-1].hasNeighbour=L->hasNeighbour; LINES[_lineCount-1].length=L->length; LINES[_lineCount-1].points[0]=L->points[0]; LINES[_lineCount-1].points[1]=L->points[1]; } numLines=numLines+vecLptr->size();}//Ermittelung aller existierenden Punkteint h=0;for (int z=0;z<(int)F->size();z++){ QPoints.resize(F->at(z).Linienzug.size()+h+1); QPointsx.resize(F->at(z).Linienzug.size()+h+1); QPointsy.resize(F->at(z).Linienzug.size()+h+1);for (unsigned int i=0;i<F->at(z).Linienzug.size();i+=1){for (unsigned int j=0;j<2;j++){QPoints[h+i+j].rx()=F->at(z).Linienzug[i].points[j].x.toFloat();QPoints[h+i+j].ry()=F->at(z).Linienzug[i].points[j].y.toFloat();QPointsx[h+i+j]=F->at(z).Linienzug[i].points[j].x.toFloat();QPointsy[h+i+j]=F->at(z).Linienzug[i].points[j].y.toFloat();}}h=QPoints.size();}numPoints=QPoints.size();int z=0; for (unsigned int i=0;i<(unsigned int)numPoints-1;i+=1){ for (unsigned int j=0;j<2;j++){ xmin=std::min((qreal)xmin,QPoints[z].rx()); ymin=std::min((qreal)ymin,QPoints[z].ry()); xmax=std::max((qreal)xmax,QPoints[z].rx()); ymax=std::max((qreal)ymax,QPoints[z].ry()); } z++; xmin=std::min((qreal)xmin,QPoints[z].rx()); ymin=std::min((qreal)ymin,QPoints[z].ry()); xmax=std::max((qreal)xmax,QPoints[z].rx()); ymax=std::max((qreal)ymax,QPoints[z].ry()); }qDebug()<<xmin;qDebug()<<xmax;qDebug()<<ymin;qDebug()<<ymax; QPen outlinePen; outlinePen.setWidth(2); outlinePen.setColor(QColor(200,200,100)); QColor a[7]={Qt::blue,Qt::green,Qt::yellow,Qt::red,Qt::black,Qt::magenta,Qt::cyan}; for (int j=0; j<(int)F->size();j++){ outlinePen.setColor(a[j%7]); qDebug()<<F->size(); h=F->at(j).Linienzug.size(); qDebug()<<h; for (int i=0; i<h;i++){ qDebug()<<F->at(j).Linienzug[i].points[0].x.toFloat(); this->scene->addLine(F->at(j).Linienzug[i].points[0].x.toFloat()-this->xmin,F->at(j).Linienzug[i].points[0].y.toFloat()-ymin,F->at(j).Linienzug[i].points[1].x.toFloat()-xmin,F->at(j).Linienzug[i].points[1].y.toFloat()-ymin,outlinePen); } } QRectF* rect1=nullptr; rect1=new QRectF(0,0,1000,1000); scene->setSceneRect(*rect1); };//Destruktor ~myScene(){};signals:protected slots:};#endif // MYSCENE_H
Code:
#include "qlabel.h"#include <QGraphicsView>#include <QWidget>#include <QDialog>#include <QDebug>#include "myStructs.h"#include "myscene.h"#include <QGraphicsView>#include <QPointF>#include <QLineEdit>#include <QTimer>#include <QMouseEvent>#ifndef MYGRAPHICSVIEW_H#define MYGRAPHICSVIEW_H#endif // MYGRAPHICSVIEW_Hclass myGraphicsView : public QGraphicsView{private:int xold=0,yold=0;int xpos=0,ypos=0;unsigned long way=0;public:myGraphicsView(myScene*_scene=NULL,QWidget *parent = NULL);QGraphicsScene *_sc =nullptr;QGraphicsView*_view=nullptr;QLabel*lab=nullptr;~myGraphicsView();private:protected: void mouseMoveEvent(QMouseEvent*event);private slots:};
Code:
#include "myGraphicsView.h"#include "myscene.h"#include <qmath.h>myGraphicsView::myGraphicsView(myScene *_scene, QWidget *parent):QGraphicsView(_scene->scene,parent){this->_view=new QGraphicsView(_scene->scene,parent);parent->setMouseTracking(1);_view->setMouseTracking(1);_view->showMaximized();};void myGraphicsView::mouseMoveEvent(QMouseEvent*){ qDebug()<<"hhh";};myGraphicsView::~myGraphicsView(){};;
Statistik: Verfasst von Bolzen — 4. April 2023 22:26
Code:
// Anzeige Akku SOC// ---------------------------// https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-system_power_status _SYSTEM_POWER_STATUS *power = new _SYSTEM_POWER_STATUS; qDebug() << "Akku Stand: SOC = " << power->BatteryLifePercent; qDebug() << "Akku ACLineStatus = " << power->ACLineStatus;
Code:
Akku Stand: SOC = 0Akku ACLineStatus = 0
Statistik: Verfasst von kendo — 31. März 2023 21:34
Statistik: Verfasst von sowas — 30. März 2023 15:26
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QStringList zeile = {5 3
6 4
7 1
10 5
11 6
12 3
12 4};
int znr = zeile.size();
qInfo() << zeile.at(0) << zeile.size();
teil[0] = zeile.at(0); // name
qInfo()<< "teil[0]" << teil[0];
//------------
teil[1] = zeile.at(1); // id
qInfo()<< "teil[1]" << teil[1];
return a.exec();
}
Statistik: Verfasst von sowas — 30. März 2023 12:08
Statistik: Verfasst von helmut.jakoby — 30. März 2023 08:06
Statistik: Verfasst von sowas — 29. März 2023 15:58
Code:
Datei test.txtZeile: 10[
Statistik: Verfasst von midabasy — 28. März 2023 10:41
Statistik: Verfasst von Volker75 — 22. März 2023 21:15
Statistik: Verfasst von rechtsanwaltsteyer — 20. März 2023 16:43
Statistik: Verfasst von rechtsanwaltsteyer — 14. März 2023 14:42
Statistik: Verfasst von zwuebbl — 14. März 2023 06:50
Statistik: Verfasst von Bronski — 7. März 2023 02:46