Solved Searching Button Text
-
@Epiales666 Ok, so to fix your slot definition just change this line in your header file:
private slots: void MainWindow::on_lineEdit_textChanged();
to be:
private slots: void on_lineEdit_textChanged(const QString &);
As for the findChildren, everything looks good there, so after you fix this above error give me a full build log with errors in it.
-
U're awesome hon... Thank you very, very much. I've done some php coding.. actually, quite a bit of php coding for games and stuff... but my issue is I've never taking any C++ Courses or anything related. Google is my friend, and most of what I've done, I've basically been able to find code snippets and figure just about anything out when I was programming with php and mysql/mysqli... I've made several games that used bitcoin to play them if you wanted to upgrade your items and stuff. I LOVE doing things like this. I just need to really sit back and start learning C++ now.
You are awesome, and @SGaist is awesome. There are not many places you can actually go to where people are willing to even write code for you to help you. I know that's basically what has happened. What the developer didn't write for me, I could easily write, like the commands that actually open the exe files. I had to figure a way to make it work because qt doesn't want to recognize white spaces like "Program Files"... that space messed it all up. So I just used the AHK program and wrote a script to initiate the exe file when pressing the button. So I do know how to do some. Not completely crippled lol.
Again, thanks for the awesome help hon.
-
@ambershark said in Searching Button Text:
void on_lineEdit_textChanged(const QString &);
Okay, I replaced the code, and I still get that error about the > for some reason.
C:\Users\dclar.DESKTOP-JTNNAGR\Desktop\test\ApplicationPicker\mainwindow.cpp:185: error: C2059: syntax error : '>'
On this line:QList<QPushButton *> buttons = findChildren<QPushButton *>();
And I tried the double quotes and several other ways to try and get the white spaces recognized. In the end, I needed the AHK program to do it for me. It's completely annoying, as I have to have one script file for EVERY button. But it's for my personal use, so it's not that big of a deal. Eventually I want to try and learn how to make a widget... I think that's it... Then have an add button that would add that widget to the mainwindow. This way I could add the exe files and save them or delete them and have it alphabetize them. I know that's WAY over my head for now, but I want to learn to do it. Sorry I'm ranting lol. U're actually online and I love to talk lol.
-
So frustrating.... every where on google I've searched, that line is correctly written... but it throws that error.... grrrr
QList<QPushButton *> buttons = findChildren<QPushButton *>();
The Syntax Error: '>'
What a mess lol....
-
HAHA, I'm always messing with stuff. I've been removing and editing now for like an hour or more. I have it working. I removed the void findChildren(); from the header and it worked. lol....
only issue is, it still shows the EMPTY buttons instead of removing them. Yeah, it removes the text and hides it, but in order to get to the exe that it's searching, I must scroll down to get to it.
I'm assuming it's coded to just remove the text...not the buttons?
Anyway.. thank you very much hon, and sorry for being difficult.
-
Sorry, my misinformation. It's removing the buttons, but showing the icons. That is why I"m having to scroll down to get to the program. I'm going to try and write something to remove the icons as well. Wish me luck. If you feel generous, maybe you can help me get that done :)
You are GREAT.. So thank you very much. This is what it looks like when I search for something at the bottom of the window lol...
-
Aha lol... I figured out how to remove the labels as well. I"m a fast learner once I get the code lol...
Now, having the results appear at the top is the last thing. Right now they appear in the middle. It might just be as easy as aligning the scroll area, so I'll mess with it. Thank you again. I'll let you know what I come up with. YAY YOU...thx hon
-
Okay hon... my last reply to you lol. I get excited when things work out and work properly :D
This is what it looks like when I search.
https://gyazo.com/a28eacded4f5faa1861062dde5fc6c20
Now I have aligned the actual scroll area to be aligned to the top and the left, but that didn't work. Just need to figure out how to put the searched items at the top and not separated. Any ideas? If u're tired of me, no worries, I"ll figure it out, or make it work as is. You've been extremely wonderful. Thank you and the other guy...
---------{@ X Eternity
-
@Epiales666 Hmm, did you try
setAlignment(Qt::AlignHCenter | Qt::AlignTop);
?I don't work with scroll areas much but that alignment should do it. It could be from hiding and showing those labels and buttons that is causing it to act weird. Not necessarily the best solution but it should work. :)
Also if you make a custom class for your buttons that can handle the picture and the button then you wouldn't need to hide/show them separately since it would just be one object. Something for a later time once you learn a bit more. :)
-
@ambershark said in Searching Button Text:
setAlignment(Qt::AlignHCenter | Qt::AlignTop);
yeah, I've been working on it since I talked to you last. Haven't taken a break, and havn't figured anything out lmao...
When I put the above in the cpp, I get this:
C:\Users\dclar.DESKTOP-JTNNAGR\Desktop\test\ApplicationPicker\mainwindow.cpp:200: error: C3861: 'setAlignment': identifier not found
-
@Epiales666 Well you need your scroll area object... I don't know what it's called but I'll assume it's in your ui variable... let's just say
ui->myScrollArea->setAlignment(...)
that should help you. Of course replace it with the actual variable. :)You could probably set that in designer too somewhere. I'm not sure though I don't really use the designer. I tend to just write the code by hand.
-
Makes sense... it's just scrollArea.. and I added but it doesn't actually do anything. There are no errors, but it doesn't work ... Story of my life LOL... Thanks Hon... I'm still a chuggin along working on it. :)
-
I have tried this:
ui->scrollArea->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
Maybe it's a scroll area thing. I have no idea why it won't work.
-
Okay... I had the stuff snapped to the mainwindows grid, so that's why I couldn't align it properly. I rewrote the entire thing and it works now. At least mostly. Some items will show in the middle, while most of them show at the top. Not sure why it does that, but it's workable.
And about the labels? When I do a search/filter on the labels, along with the buttons, they show up just fine without any issues. But once I put a picture in the label, they don't show anymore. Not sure why that would have anything to do with it, since it's still considered a QLabel...
Anyway, it works as good as I can get it I think. Thank you so very much for your help.