Qt创建者生成问题

编程入门 行业动态 更新时间:2024-10-23 11:27:44
本文介绍了Qt创建者生成问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在为kde linux环境制作文件哈希计算器应用程序 但是我遇到了一些问题: 在此代码中计算文件的哈希值

hashwrapper * sha512 = new sha512wrapper(); std :: string sha512Hashing = sha512-> getHashFromFile(file01.iso);

你注意到 file01.iso 这里 我的问题是: 1.如何在此处放置插值文件而不是预定义的文件? i意味着我不知道用户将在高级中选择的文件的名称 所以我如何在Ruby中进行插值移动我们这样做

userInput =获取#{userInput}

我如何在Qt Creator中这样做 2.我有一个lineEdit框,我只用来显示文件的名称 ,用户将在关闭QFileDialog后选择 如何显示lineEdit框中的文件名? 我很感谢谁回答我的问题 我的尝试:

QFile filename01; hashwrapper * sha512 = new sha512wrapper(); std :: string sha512Hashing = sha512-> getHashFromFile(filename01);

和很多类似的动作但没有运气

解决方案

您很可能会使用对话框。预定义的OpenFileDialog或 QDialog Class | Qt 4.8 [ ^ ]。

我找到了solusion

QString open_file = QFileDialog :: getOpenFileName(此, 打开文件, / home path); QFile file01(open_file);

现在如果您想将该文件用于您喜欢的任何操作 例如(获取文件名或大小)只需使用(file01) 即可进行操作 顺便提一下QFileDialog上有两种类型的文件 1.静态文件....示例(/home/user/documents/file01.iso) 2.动态文件...示例(用户将从Open Dialog中选择的文件) i希望这对我这样的初学者来说很清楚

i'm making a files hash calculator app for a kde linux enviroment but i'm facing a few problems: in this code that calculate the file's hash

hashwrapper *sha512 = new sha512wrapper(); std::string sha512Hashing = sha512->getHashFromFile("file01.iso");

you notice the file01.iso here my question is: 1. how to place an interpolation file here instead of a predefined file? i mean i don't know the name of the file that the user will choose in advanced so how i do an interpolating move like in Ruby we do

userInput=gets #{userInput}

how do i do so in Qt Creator 2. i have a lineEdit box that i made only to display the name of the file that the user will choose after closing QFileDialog how display the file name in the lineEdit box ? i'm so grateful to whoever whom will answer my questions What I have tried:

QFile filename01; hashwrapper *sha512 = new sha512wrapper(); std::string sha512Hashing = sha512->getHashFromFile(filename01);

and a lot of similar moves but no luck

解决方案

You would most likely use a dialog. Either a predefined OpenFileDialog or QDialog Class | Qt 4.8[^].

i have found the solusion

QString open_file = QFileDialog::getOpenFileName(this,"open file","/home path"); QFile file01(open_file);

now if you want to use the file for any operation you like for example (get the file name or size) just use (file01) to do operations on by the way there's 2 types of files on QFileDialog 1. Static File....example ("/home/user/documents/file01.iso") 2. Dynamic File...example (the file that the user WILL pick from Open Dialog) i hope this will be clear to the beginners like myself

更多推荐

Qt创建者生成问题

本文发布于:2023-11-28 16:55:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643212.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:创建者   Qt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!